| Recommend this page to a friend! |
| PHP HTTP protocol client | > | All threads | > | Cookies disappear on certain pages | > | (Un) Subscribe thread alerts |
| |||||||||||||||
Your script was very good. maybe this is a mistake in writing my script. I make a request to some page with a specific sequence. all pages successfully requested. but there is a page where cookies are not registered / disappear.
below the header data is successfully requested. Below is the result of a request header. This is request from http://luxonline.luxottica.com/webapp/wcs/stores/servlet/Logon ------------------------------------------------------------------------------------------------------------------------- Host: luxonline.luxottica.com User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Pragma: nocache Content-Type: application/x-www-form-urlencoded Content-Length: 129 http/1.1 200 ok: date: Tue, 05 Oct 2010 05:11:10 GMT server: WebSphere Application Server/5.0 expires: Thu, 01 Dec 1994 16:00:00 GMT set-cookie: WC_USERSESSION_743844=743844%2c%2d1%2cEUR%2c%2d2000%2cnull%2cnull%2cnull%2cnull%2cnull%2cnull%2cnull%2cnull%2c%5b10001%7c10001%7c10001%7cnull%7c%2d2000%5d%2cB6Jmk9AIFmMSyp0GFq9oRu2%2bzRA%3d;Path=/ cache-control: private transfer-encoding: chunked content-type: text/html; charset=UTF-8 content-language: it-IT Below is the result of a request header. This is request from http://luxonline.luxottica.com/webapp/wcs/stores/servlet/CatalogBrandSelection ------------------------------------------------------------------------------------------------------------------------- Host: luxonline.luxottica.com User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Pragma: nocache Content-Type: application/x-www-form-urlencoded Content-Length: 110 http/1.1 200 ok: date: Tue, 05 Oct 2010 05:11:17 GMT server: WebSphere Application Server/5.0 expires: Thu, 01 Dec 1994 16:00:00 GMT set-cookie: WC_USERSESSION_743844=743844%2c%2d1%2cEUR%2c%2d2000%2cnull%2cnull%2cnull%2cnull%2cnull%2cnull%2cnull%2cnull%2c%5b10001%7c10001%7c10001%7cnull%7c%2d2000%5d%2cB6Jmk9AIFmMSyp0GFq9oRu2%2bzRA%3d;Path=/ cache-control: private transfer-encoding: chunked content-type: text/html; charset=UTF-8 content-language: it-IT Below is the result of a request header. This is request from http://luxonline.luxottica.com/webapp/wcs/stores/servlet/CatalogModelSelection ------------------------------------------------------------------------------------------------------------------------- Host: luxonline.luxottica.com User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Pragma: nocache Content-Type: application/x-www-form-urlencoded Content-Length: 233 http/1.1 200 ok: date: Tue, 05 Oct 2010 05:11:20 GMT server: WebSphere Application Server/5.0 expires: Thu, 01 Dec 1994 16:00:00 GMT set-cookie: WC_USERSESSION_743844=743844%2c%2d1%2cEUR%2c%2d2000%2cnull%2cnull%2cnull%2cnull%2cnull%2cnull%2cnull%2cnull%2c%5b10001%7c10001%7c10001%7cnull%7c%2d2000%5d%2cB6Jmk9AIFmMSyp0GFq9oRu2%2bzRA%3d;Path=/ cache-control: private transfer-encoding: chunked content-type: text/html; charset=UTF-8 content-language: it-IT Below is the result of a request header. This is request from http://luxonline.luxottica.com/webapp/wcs/stores/servlet/CatalogSKUSelection Here, the cookie disappears. In contrast to the request on another page, here there is no cookie. ------------------------------------------------------------------------------------------------------------------------- Host: luxonline.luxottica.com User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Pragma: nocache Content-Type: application/x-www-form-urlencoded Content-Length: 374 http/1.1 200 ok: date: Tue, 05 Oct 2010 05:11:25 GMT server: WebSphere Application Server/5.0 transfer-encoding: chunked content-type: text/html; charset=UTF-8 content-language: it-IT Below is the result of a request header. This is request from http://luxonline.luxottica.com/webapp/wcs/stores/servlet/CatalogModelSelection Here cookies are still available! ------------------------------------------------------------------------------------------------------------------------- Host: luxonline.luxottica.com User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Pragma: nocache Content-Type: application/x-www-form-urlencoded Content-Length: 233 http/1.1 200 ok: date: Tue, 05 Oct 2010 05:11:29 GMT server: WebSphere Application Server/5.0 expires: Thu, 01 Dec 1994 16:00:00 GMT set-cookie: WC_USERSESSION_743844=743844%2c%2d1%2cEUR%2c%2d2000%2cnull%2cnull%2cnull%2cnull%2cnull%2cnull%2cnull%2cnull%2c%5b10001%7c10001%7c10001%7cnull%7c%2d2000%5d%2cB6Jmk9AIFmMSyp0GFq9oRu2%2bzRA%3d;Path=/ cache-control: private transfer-encoding: chunked content-type: text/html; charset=UTF-8 content-language: it-IT Please help me what is wrong here? Thank you very much.
This is my code.
<?php require("http.php"); set_time_limit(0); $http=new http_class; $http->timeout=0; $http->data_timeout=0; $http->debug=0; $http->html_debug=0; $http->user_agent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"; $http->follow_redirect=1; $http->redirection_limit=5; $http->exclude_address=""; $http->prefer_curl=0; $user=""; $password=""; $realm=""; /* Authentication realm or domain */ $workstation=""; /* Workstation for NTLM authentication */ $authentication=(strlen($user) ? UrlEncode($user).":".UrlEncode($password)."@" : ""); $url="http://luxonline.luxottica.com/webapp/wcs/stores/servlet/Logon"; echo "<hr>Below is the result of a request header.<br>"; echo "This is request from http://luxonline.luxottica.com/webapp/wcs/stores/servlet/Logon"; echo "-------------------------------------------------------------------------------------------------------------------------<hr><br>"; $error=$http->GetRequestArguments($url,$arguments); $arguments["RequestMethod"]="POST"; unset($arguments["PostValues"]); $arguments["PostValues"]=array( "storeId"=>"10001", "langId"=>"-1", "reLogonURL"=>"LogonForm", "URL"=>"HomePage", "reserverd_viewname"=>"HomePage", "logonId"=>"nlcu00123680", "logonPassword"=>"xxxxxx" ); $arguments["Referer"]=""; if(strlen($realm)) $arguments["AuthRealm"]=$realm; if(strlen($workstation)) $arguments["AuthWorkstation"]=$workstation; $http->authentication_mechanism=""; // force a given authentication mechanism; $arguments["Headers"]["Pragma"]="nocache"; $error=$http->Open($arguments); if($error=="") { $error=$http->SendRequest($arguments); if($error=="") { for(Reset($http->request_headers),$header=0;$header<count($http->request_headers);Next($http->request_headers),$header++) { $header_name=Key($http->request_headers); if(GetType($http->request_headers[$header_name])=="array") { for($header_value=0;$header_value<count($http->request_headers[$header_name]);$header_value++) echo $header_name.": ".$http->request_headers[$header_name][$header_value],"\r\n<br>"; } else echo $header_name.": ".$http->request_headers[$header_name],"\r\n<br>"; } flush(); $headers=array(); $error=$http->ReadReplyHeaders($headers); if($error=="") { for(Reset($headers),$header=0;$header<count($headers);Next($headers),$header++) { $header_name=Key($headers); if(GetType($headers[$header_name])=="array") { for($header_value=0;$header_value<count($headers[$header_name]);$header_value++) echo $header_name.": ".$headers[$header_name][$header_value],"\r\n<br>"; } else echo $header_name.": ".$headers[$header_name],"\r\n<br>"; } flush(); for(;;) { $error=$http->ReadReplyBody($body,1000); if($error!="" || strlen($body)==0) break; } flush(); } } $http->Close(); } /* NEXT PAGE --------------------------------------------------------------------------------------*/ $url="http://luxonline.luxottica.com/webapp/wcs/stores/servlet/CatalogBrandSelection"; echo "<hr>Below is the result of a request header.<br>"; echo "This is request from http://luxonline.luxottica.com/webapp/wcs/stores/servlet/CatalogBrandSelection"; echo "-------------------------------------------------------------------------------------------------------------------------<hr><br>"; $error=$http->GetRequestArguments($url,$arguments); $arguments["RequestMethod"]="POST"; unset($arguments["PostValues"]); $arguments["PostValues"]=array( "storeId"=>"10001", "langId"=>"-1", "reserverd_prevUrl"=>"CatalogBrandSelection", "reserverd_url"=>"home", "reserverd_viewname"=>"HomePage" ); $arguments["Referer"]=""; if(strlen($realm)) $arguments["AuthRealm"]=$realm; if(strlen($workstation)) $arguments["AuthWorkstation"]=$workstation; $http->authentication_mechanism=""; // force a given authentication mechanism; $arguments["Headers"]["Pragma"]="nocache"; $error=$http->Open($arguments); if($error=="") { $error=$http->SendRequest($arguments); if($error=="") { for(Reset($http->request_headers),$header=0;$header<count($http->request_headers);Next($http->request_headers),$header++) { $header_name=Key($http->request_headers); if(GetType($http->request_headers[$header_name])=="array") { for($header_value=0;$header_value<count($http->request_headers[$header_name]);$header_value++) echo $header_name.": ".$http->request_headers[$header_name][$header_value],"\r\n<br>"; } else echo $header_name.": ".$http->request_headers[$header_name],"\r\n<br>"; } flush(); $headers=array(); $error=$http->ReadReplyHeaders($headers); if($error=="") { for(Reset($headers),$header=0;$header<count($headers);Next($headers),$header++) { $header_name=Key($headers); if(GetType($headers[$header_name])=="array") { for($header_value=0;$header_value<count($headers[$header_name]);$header_value++) echo $header_name.": ".$headers[$header_name][$header_value],"\r\n<br>"; } else echo $header_name.": ".$headers[$header_name],"\r\n<br>"; } flush(); for(;;) { $error=$http->ReadReplyBody($body,1000); if($error!="" || strlen($body)==0) break; } flush(); } } $http->Close(); } /* NEXT PAGE --------------------------------------------------------------------------------------*/ $url="http://luxonline.luxottica.com/webapp/wcs/stores/servlet/CatalogModelSelection"; echo "<hr>Below is the result of a request header.<br>"; echo "This is request from http://luxonline.luxottica.com/webapp/wcs/stores/servlet/CatalogModelSelection"; echo "-------------------------------------------------------------------------------------------------------------------------<hr><br>"; $error=$http->GetRequestArguments($url,$arguments); $arguments["RequestMethod"]="POST"; unset($arguments["PostValues"]); $arguments["PostValues"]=array( "storeId"=>"10001", "langId"=>"-1", "reserverd_prevUrl"=>"Home", "reserverd_url"=>"CatalogBrandSelection", "reserverd_viewname"=>"CatalogBrandSelectionPage", "brand_id"=>"10559", "catalog_inOrderSheet"=>"T", "catalog_accesss_from_brand_selection"=>"T", "PriceVisibilitySelection"=>"002" ); $arguments["Referer"]=""; if(strlen($realm)) $arguments["AuthRealm"]=$realm; if(strlen($workstation)) $arguments["AuthWorkstation"]=$workstation; $http->authentication_mechanism=""; // force a given authentication mechanism; $arguments["Headers"]["Pragma"]="nocache"; $error=$http->Open($arguments); if($error=="") { $error=$http->SendRequest($arguments); if($error=="") { for(Reset($http->request_headers),$header=0;$header<count($http->request_headers);Next($http->request_headers),$header++) { $header_name=Key($http->request_headers); if(GetType($http->request_headers[$header_name])=="array") { for($header_value=0;$header_value<count($http->request_headers[$header_name]);$header_value++) echo $header_name.": ".$http->request_headers[$header_name][$header_value],"\r\n<br>"; } else echo $header_name.": ".$http->request_headers[$header_name],"\r\n<br>"; } flush(); $headers=array(); $error=$http->ReadReplyHeaders($headers); if($error=="") { for(Reset($headers),$header=0;$header<count($headers);Next($headers),$header++) { $header_name=Key($headers); if(GetType($headers[$header_name])=="array") { for($header_value=0;$header_value<count($headers[$header_name]);$header_value++) echo $header_name.": ".$headers[$header_name][$header_value],"\r\n<br>"; } else echo $header_name.": ".$headers[$header_name],"\r\n<br>"; } flush(); $output = ""; for(;;) { $error=$http->ReadReplyBody($body,1000); if($error!="" || strlen($body)==0) break; $output .= $body; } flush(); } } $http->Close(); } /* NEXT PAGE --------------------------------------------------------------------------------------*/ $url="http://luxonline.luxottica.com/webapp/wcs/stores/servlet/CatalogSKUSelection"; echo "<hr>Below is the result of a request header.<br>"; echo "This is request from http://luxonline.luxottica.com/webapp/wcs/stores/servlet/CatalogSKUSelection<br>"; echo "Here, the cookie disappears. In contrast to the request on another page, here there is no cookie."; echo "-------------------------------------------------------------------------------------------------------------------------<hr><br>"; $error=$http->GetRequestArguments($url,$arguments); $arguments["RequestMethod"]="POST"; unset($arguments["PostValues"]); $arguments["PostValues"]=array( "storeId"=>"10001", "reserverd_prevUrl"=>"CatalogBrandSelection", "reserverd_url"=>"CatalogModelSelection", "reserverd_viewname"=>"CatalogModelSelectionPage", "langId"=>"-1", "model_id"=>"357161", "control_updBackProps"=>"T", "update_order_sheet_properties"=>"", "update_model_rendering"=>"", "brand_id"=>"10559", "PriceVisibilitySelection"=>"002", "catalog_access_from_simple_search"=>"T", "ssearch_key"=>"", "model_rendering"=>"001", "catalog_inOrderSheet"=>"T" ); $arguments["Referer"]=""; if(strlen($realm)) $arguments["AuthRealm"]=$realm; if(strlen($workstation)) $arguments["AuthWorkstation"]=$workstation; $http->authentication_mechanism=""; // force a given authentication mechanism; $arguments["Headers"]["Pragma"]="nocache"; $error=$http->Open($arguments); if($error=="") { $error=$http->SendRequest($arguments); if($error=="") { for(Reset($http->request_headers),$header=0;$header<count($http->request_headers);Next($http->request_headers),$header++) { $header_name=Key($http->request_headers); if(GetType($http->request_headers[$header_name])=="array") { for($header_value=0;$header_value<count($http->request_headers[$header_name]);$header_value++) echo $header_name.": ".$http->request_headers[$header_name][$header_value],"\r\n<br>"; } else echo $header_name.": ".$http->request_headers[$header_name],"\r\n<br>"; } flush(); $headers=array(); $error=$http->ReadReplyHeaders($headers); if($error=="") { for(Reset($headers),$header=0;$header<count($headers);Next($headers),$header++) { $header_name=Key($headers); if(GetType($headers[$header_name])=="array") { for($header_value=0;$header_value<count($headers[$header_name]);$header_value++) echo $header_name.": ".$headers[$header_name][$header_value],"\r\n<br>"; } else echo $header_name.": ".$headers[$header_name],"\r\n<br>"; } flush(); $output = ""; for(;;) { $error=$http->ReadReplyBody($body,1000); if($error!="" || strlen($body)==0) break; $output .= $body; } flush(); } } $http->Close(); } /* NEXT PAGE --------------------------------------------------------------------------------------*/ $url="http://luxonline.luxottica.com/webapp/wcs/stores/servlet/CatalogModelSelection"; echo "<hr>Below is the result of a request header.<br>"; echo "This is request from http://luxonline.luxottica.com/webapp/wcs/stores/servlet/CatalogModelSelection<br>"; echo "Here cookies are still available!"; echo "-------------------------------------------------------------------------------------------------------------------------<hr><br>"; $error=$http->GetRequestArguments($url,$arguments); $arguments["RequestMethod"]="POST"; unset($arguments["PostValues"]); $arguments["PostValues"]=array( "storeId"=>"10001", "langId"=>"-1", "reserverd_prevUrl"=>"Home", "reserverd_url"=>"CatalogBrandSelection", "reserverd_viewname"=>"CatalogBrandSelectionPage", "brand_id"=>"10559", "catalog_inOrderSheet"=>"T", "catalog_accesss_from_brand_selection"=>"T", "PriceVisibilitySelection"=>"002" ); $arguments["Referer"]=""; if(strlen($realm)) $arguments["AuthRealm"]=$realm; if(strlen($workstation)) $arguments["AuthWorkstation"]=$workstation; $http->authentication_mechanism=""; // force a given authentication mechanism; $arguments["Headers"]["Pragma"]="nocache"; $error=$http->Open($arguments); if($error=="") { $error=$http->SendRequest($arguments); if($error=="") { for(Reset($http->request_headers),$header=0;$header<count($http->request_headers);Next($http->request_headers),$header++) { $header_name=Key($http->request_headers); if(GetType($http->request_headers[$header_name])=="array") { for($header_value=0;$header_value<count($http->request_headers[$header_name]);$header_value++) echo $header_name.": ".$http->request_headers[$header_name][$header_value],"\r\n<br>"; } else echo $header_name.": ".$http->request_headers[$header_name],"\r\n<br>"; } flush(); $headers=array(); $error=$http->ReadReplyHeaders($headers); if($error=="") { for(Reset($headers),$header=0;$header<count($headers);Next($headers),$header++) { $header_name=Key($headers); if(GetType($headers[$header_name])=="array") { for($header_value=0;$header_value<count($headers[$header_name]);$header_value++) echo $header_name.": ".$headers[$header_name][$header_value],"\r\n<br>"; } else echo $header_name.": ".$headers[$header_name],"\r\n<br>"; } flush(); $output = ""; for(;;) { $error=$http->ReadReplyBody($body,1000); if($error!="" || strlen($body)==0) break; $output .= $body; } flush(); } } $http->Close(); } if(strlen($error)) echo "<CENTER><H2>Error: ",$error,"</H2><CENTER>\n"; ?> |
info at phpclasses dot org.
