0

I fetched the header response using following code

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 1);
$c = curl_exec('http://plagiarismcheckerx.com');
echo $c;
curl_close($ch);

but i'm getting only response header. but the other section request header is not receiving.

i got the following response

HTTP/1.1 200 OK 
Content-Length: 25041 
Server: nginx/1.10.3 
Date: Sat, 18 Feb 2017 18:55:31 GMT 
Content-Type: text/html; 
charset=UTF-8 
Connection: keep-alive 
Expires: Thu, 19 Nov 1981 08:52:00 GMT 
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Set-Cookie: 
PHPSESSID=66d5ecd1ad8e3a49b7e69af8aaec8e26; path=/ Vary: Accept-Encoding

but actual and complete header is given below . I copied it from chrome developer tool from network section.

Request URL:http://plagiarismcheckerx.com/
Request Method:GET
Status Code:200 OK
Remote Address:108.167.140.179:80

**Response Headers**
view source
Cache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection:keep-alive
Content-Length:25041
Content-Type:text/html; charset=UTF-8
Date:Sat, 18 Feb 2017 18:59:27 GMT
Expires:Thu, 19 Nov 1981 08:52:00 GMT
Pragma:no-cache
Server:nginx/1.10.3
Vary:Accept-Encoding


**Request Headers**
    view source
    Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
    Accept-Encoding:gzip, deflate, sdch
    Accept-Language:en-US,en;q=0.8
    Cache-Control:max-age=0
    Connection:keep-alive
    Cookie:PHPSESSID=2c94b931c6f490824e33fb66fe094c5b; __lnkrntdmcvrd=-1; _ga=GA1.2.679844744.1487408717; _gat=1; __zlcmid=f9gEfJx3I2lwCx
    Host:plagiarismcheckerx.com
    Upgrade-Insecure-Requests:1
    User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36
learner
  • 171
  • 2
  • 11
  • how can i get full header detail similar to chrome result – learner Feb 18 '17 at 19:16
  • Possible duplicate of [How can I see the request headers made by curl when sending a request to the server?](http://stackoverflow.com/questions/866946/how-can-i-see-the-request-headers-made-by-curl-when-sending-a-request-to-the-ser) – miken32 Feb 18 '17 at 19:16
  • there is one solution is given curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLINFO_HEADER_OUT, true); $data = curl_exec($ch); var_dump($data); var_dump(curl_getinfo($ch)); which is also not working – learner Feb 18 '17 at 19:20
  • $ curl -v -I -H how this can be written in php – learner Feb 18 '17 at 19:27

0 Answers0