|
|
 José Silva, Jr. - 2007-11-23 18:05:16
Hi all.
I have a trouble when sent a post, the page don't mantein the session (the class create a new PHPSESSID). Below, the code and debug.
I appreciate any help. Regards.
PS: Sorry for my bad English.
------------------------------
$postURL = 'http://localhost/test/test.php';
$error = $http->GetRequestArguments($postURL,$postArgumentos);
$postArgumentos['RequestMethod'] = 'POST';
$postArgumentos['PostValues'] = array(
'codigo' => 10,
'anuncianteID' => 1
);
$error = $http->Open($postArgumentos);
if($error == ''){
$error = $http->SendRequest($postArgumentos);
if($error == '') {
$headers = array();
$error = $http->ReadReplyHeaders($headers);
if($error == '') {
for(;;) {
$error=$http->ReadReplyBody($body,1000);
if($error != '' || strlen($body)==0)
break;
echo ($body);
}
}
}
}
-----------------------------
Connecting to localhost
Resolving HTTP server domain "localhost"...
Connecting to HTTP server IP 127.0.0.1...
Connected to localhost
C POST /acheiautos/sistema/banners.php HTTP/1.1
C Host: localhost
C User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
C Content-Type: application/x-www-form-urlencoded
C Content-Length: 58
C <!-- HERE IS WHERE THE COOKIE INFO MUST BE -->
C codigo=10&anuncianteID=1
S HTTP/1.1 200 OK
S Date: Fri, 23 Nov 2007 17:54:32 GMT
S Server: Apache/2.2.4 (Win32) PHP/5.2.4
S X-Powered-By: PHP/5.2.4
S Set-Cookie: PHPSESSID=jfi47ju5lo6ph49mvo7vgffqs6; path=/
S Expires: Thu, 19 Nov 1981 08:52:00 GMT
S Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
S Pragma: no-cache
S Transfer-Encoding: chunked
S Content-Type: text/html
S
S 4144
S
 Manuel Lemos - 2007-11-25 04:23:24 - In reply to message 1 from José Silva, Jr.
The class keeps track of the cookies sent by the server. If the server sets a cookie, next requests will be sent with cookies that have not yet expired.
 José Silva, Jr. - 2007-11-28 18:59:54 - In reply to message 2 from Manuel Lemos
Manuel,
Thanks for answer. But, I made a fill tests and the session cookie has not expired (another script can access the session without difficult). Just the post by the class that can't receive the current session. So, I will continue with the tests. Thanks again.
 Manuel Lemos - 2007-12-05 06:56:11 - In reply to message 3 from José Silva, Jr.
As you may see by the response of the POST request, the server is returning a PHPSESSID non-persistent cookie. In the following requests that you make with the same object (do not create a new object) the class will resend the cookie.
|