I want to read a cookie value that I received after a login by sending a POST request.
Then I want to send that cookie value to another action of the curl with another post request. But after sending it when I'm trying to see all the post headers, it shows that I have sent a cookie value. This value is not available for my posted URL, so is not able to access information due to authentication. Please tell me that I have done something wrong:
$ ur1 = "http://www.getinf.com/iconf/user?action=bu group"; $ Postfields1 = "device = mapp and type = ajax & amp; name1 = rA & cc1 = 91 & amp; min1 = 90name2 = imm & cc2 = 91 & amp; min2 = 97"; // post request sends $ ch1 = curl_init (); Curl_setopt ($ ch1, CURLOPT_URL, $ URL1); Curl_setopt ($ ch1, CURLOPT_POST, 1); Curl_setopt ($ CH1, CURLOPT_COOKIE, 'JSESSIONID = 199FFF6355DEA87F3D72E692E7514AD2'); Curl_setopt ($ ch1, CURLOPT_FOLLOWLOCATION, true); Curl_setopt ($ CH1, CURLOPT_HEADER, true); Curl_setopt ($ CH1, CURLOPT_RETURNTRANSFER, 1); Curl_setopt ($ CH1, CURLOPT_POSTFIELDS, $ Postfield 1); $ Result = curl_xac ($ c1); Print_r (headers_list ()); // displays all the post request data $ ret = ReturnVal ($ results); Print_r (get_headers ($ url1, 1)); // curl_close ($ ch1);
What is wrong with this code that is blocking the JSESSIONID value accessible as a cookie value?
Find comments (or "cookies") on this page:
Do not mention in the document that you have to set a file CURLOPT_COOKIEJAR to handle curl actually use cookies, if it is not set the cookies will not be parsed.
No comments:
Post a Comment