last day (14 days later) » 

6:55 AM
1
A: Session not maintaining curl php remote-login

hindmostYou have to set both CURLOPT_COOKIEJAR and CURLOPT_COOKIEFILE options to the same absolute path value ('cookies.txt' is a relative path). This is necessary in order to enable cookies auto-handling (and therefore, session maintaining) within redirects series which the script will have. Also you s...

 
How can it set absolute path for cookie file?
 
Use dirname(__FILE__) to get the current script's directory or $SERVER['DOCUMENT_ROOT'] to get the document root directory
 
Is this $file_path = dirname(__FILE__).'/cookie.txt'; ok?
 
@Manwal Yes, see the updated answer
 
its not working. :( nothing seems to be changed. I can see cookie data is writing in cookie.text, but can't maintain session. @hindmost
 
6:55 AM
@Manwal Set CURLINFO_HEADER_OUT option to true and see what print_r($headers); outputs.
 
@hing most
headers are printing very well
array
(
[url] => http://www.ripoffreport.com/go/thanks
[content_type] => text/html; charset=UTF-8
[http_code] => 200
[header_size] => 5291
[request_size] => 3897
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 1
[total_time] => 3.672145
[namelookup_time] => 5.8E-5
[connect_time] => 7.0E-5
[pretransfer_time] => 7.4E-5
[size_upload] => 0
[size_download] => 20781
[speed_download] => 5659
[speed_upload] => 0
[download_content_length] => 0
[upload_content_length] => 0
[starttransfer_time] => 0.288472
 
It doesn't contain 'request_header' field. This mean you didn't set CURLINFO_HEADER_OUT option
 
See following header's output now i have set CURLINFO_HEADER_OUT
Array
(
[url] => http://www.ripoffreport.com/go/thanks
[content_type] => text/html; charset=UTF-8
[http_code] => 200
[header_size] => 5291
[request_size] => 3901
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 1
[total_time] => 1.359084
[namelookup_time] => 3.7E-5
[connect_time] => 4.6E-5
[pretransfer_time] => 5.5E-5
[size_upload] => 0
[size_download] => 20790
[speed_download] => 15297
[speed_upload] => 0
[download_content_length] => 0
 
It doesn't contain Content-Type request header. This mean the script doesn't actually send any data
 
Original request also don't have Content-Type request header. I have seen it in developer tool. What should i do next????
"Original request" is of live site testing request.
 
7:07 AM
Sorry, it was a typo. I meant Content-Length header, not Content-Type.
 
See screen shot there is not Content-Length header also
 
Does this snapshot contains the all request headers?
 
Yes except Content-length and Content-Type
 
I meant are there any hidden headers which doesn't fit to window?
 
Yes all request headers are showing in screen shot.
do you want to see response headers also?
 
7:17 AM
I guess why they aren't present. That's the last request of series of redirects. Because of this we don't see the sent data. You have to trace (and show) all performed requests.
As I can see from snapshot you have to select "register.aspx" in the left-side pane and show the content of right pane
 
You are correct, actually my curl request is of register.aspx. but because of i have set CURLOPT_FOLLOWLOCATION true thats why our request is automatically redirecting to thanks page and we can see headers of last request
I have now set CURLOPT_FOLLOWLOCATION false. So now its showing request headers of register.aspx
See this:
Array
(
[url] => http://www.ripoffreport.com/register.aspx
[content_type] => text/html; charset=UTF-8
[http_code] => 302
[header_size] => 4838
[request_size] => 1595
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 1.519827
[namelookup_time] => 4.3E-5
[connect_time] => 5.0E-5
[pretransfer_time] => 6.0E-5
[size_upload] => 393
[size_download] => 0
[speed_download] => 0
[speed_upload] => 258
[download_content_length] => 0
[upload_content_length] => 393
[starttransfer_time] => 1.5197
 
you have to show the request headers in your browser
 
7:39 AM
ok
 

last day (14 days later) »