Hallo!
Wenn ich folgendes mache...
$client =& new HTTP_Client();
$code = $client->get($link);
$code = $client->get($link);... sollte ich doch beim zweiten aufruf der Methode get() in der selben Session bleiben. Irgendwie geht das aber nicht, ich bekomme eine neue SESSION-ID vom Server ($link) zugewiesen.
Kann ich nicht bestätigen. Wird die Session evtl. nicht per Cookie weitergegeben? Bei mir funktioniert es (mit php.ini Standard-Einstellungen bzgl. Sessions):
<?php /* client.php: */
require_once 'HTTP/Client.php';
$link = 'http://example.com/session_id.php';
$client =& new HTTP_Client();
$code = $client->get($link);
$res =& $client->currentResponse();
echo $res['body']."\n";
$code = $client->get($link);
$res =& $client->currentResponse();
echo $res['body']."\n";
?>
<?php /* session_id.php: */
session_start();
echo session_id();
?>
$ php client.php
ff598d21552f0f56d62ed75ea894c3ac
ff598d21552f0f56d62ed75ea894c3ac
Kontrolle:
$ ngrep -p -W byline port 80
########
GET /session_id.php HTTP/1.1.
Host: example.com.
User-Agent: PEAR HTTP_Request class ( http://pear.php.net/ ).
Connection: close.
Accept-Encoding: gzip.
.
HTTP/1.1 200 OK.
Date: Wed, 08 Jun 2005 11:00:51 GMT.
X-Powered-By: PHP/4.3.10.
Set-Cookie: PHPSESSID=ff598d21552f0f56d62ed75ea894c3ac; path=/.
Connection: close.
Transfer-Encoding: chunked.
Content-Type: text/html.
.
20 .
ff598d21552f0f56d62ed75ea894c3ac.
########
GET /session_id.php HTTP/1.1.
Host: example.com.
User-Agent: PEAR HTTP_Request class ( http://pear.php.net/ ).
Connection: close.
Accept-Encoding: gzip.
Referer: http://example.com/session_id.php.
Cookie: PHPSESSID=ff598d21552f0f56d62ed75ea894c3ac.
.
HTTP/1.1 200 OK.
Date: Wed, 08 Jun 2005 11:00:51 GMT.
X-Powered-By: PHP/4.3.10.
Connection: close.
Transfer-Encoding: chunked.
Content-Type: text/html.
.
20 .
ff598d21552f0f56d62ed75ea894c3ac.
Grüße
Andreas
SELFHTML Tipps & Tricks: http://aktuell.de.selfhtml.org/tippstricks/