0

I am using my webserver for testing, and I am not too sure about how to use the headers of the request right.
It contains of some values that can be set with the curl_setopt() function like the CURLOPT_REFERER, and on the other hand I can simply set up all the header myself using CURLOPT_HTTPHEADER

This is how I am doing this now:

curl_setopt($curl, CURLINFO_HEADER_OUT, true);
$headers=array("Host: localhost/mySite/index.php","Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","Accept-Language: en-us,en;q=0.5","Accept-Encoding: gzip, deflate","Connection: keep-alive","Referer: https://localhost/mySite/index.php");
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); 

But some issues rise when I set the cookie for example.
I see in my webrowser that I have on the very first request a cookie value:

Cookie: ASP.NET_SessionId=rrnrwk453nraysm4u1adlrjk; 

ASPSESSIONIDQCDSDBDD=DLHLOOIAJEMBHJODKPGMNEED; ASPSESSIONIDQADQDACD=EMNBELFBMNKGBFKIOOHFPPGI

and for the much that I know the cookie is a response from the server, so this doesn't quite makes sense for me. My question is, what should I do if I wanted to imitiate my webrowser, how should I go about this?

How do I build the REQUEST HEADER? is it simply copying the contents of HTTPLiveHeaders ? But what about the cookies ?
Am I doing things right here ?

4

0 回答 0