Php 使用curl获取请求和响应头

Php 使用curl获取请求和响应头,php,curl,Php,Curl,我使用以下代码获取了标题响应 $ch = curl_init($url); curl_setopt($ch, CURLOPT_HEADER, 1); $c = curl_exec('http://plagiarismcheckerx.com'); echo $c; curl_close($ch); 但我得到的只是回应标题。但另一个区段请求标头未接收 我得到了以下回应 HTTP/1.1 200 OK Content-Length: 25041 Server: nginx/1.10.3 Da

我使用以下代码获取了标题响应

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 1);
$c = curl_exec('http://plagiarismcheckerx.com');
echo $c;
curl_close($ch);
但我得到的只是回应标题。但另一个区段请求标头未接收

我得到了以下回应

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
但实际和完整的标题如下所示。我从网络部分的chrome开发者工具中复制了它

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

如何获得与chrome结果类似的完整标题详细信息?有一个解决方案的可能重复项是curl_setopt($ch,CURLOPT_header,1);curl_setopt($ch,CURLINFO_HEADER_OUT,true)$数据=curl_exec($ch);var_dump($数据);变量转储(curl_getinfo($ch));这也不起作用$curl-v-I-H如何用php编写