Wind up two ways, we can refer to the use of:
Copy the Code code as follows:
#方式一
$ch = Curl_init (' http://www.jb51.net ');
curl_setopt ($ch, Curlopt_returntransfer, 1);
Curl_exec ($ch);
Echo Curl_getinfo ($ch, Curlinfo_http_code); 200
Curl_close ($ch);
Way Two
Copy CodeThe code is as follows:
Print_r (
Get_headers (' http://www.baidu.com ')
);
#返回以下内容:
/*
Array
(
[0] = = http/1.1-OK
[1] = Date:sun, 03:43:04 GMT
[2] = = content-type:text/html; Charset=utf-8
[3] = Connection:close
[4] = vary:accept-encoding
[5] = = Set-cookie:baiduid=4977af4fb1e9a5d13c79939e28d92161:fg=1; Expires=thu, 31-dec-37 23:55:55 GMT; max-age=2147483647; path=/; Domain=.baidu.com
[6] = = set-cookie:bdsvrtm=0; path=/
[7] = = set-cookie:h_ps_pssid=4681_1465_5224_6023_4759_6018_6257_6313_6328_6269; path=/; Domain=.baidu.com
[8] = = p3p:cp= "OTI DSP COR IVA our IND COM"
[9] = Cache-control:private
[] = Expires:sun, 03:42:09 GMT
[One] = x-powered-by:hphp
[[] = server:bws/1.1
[+] = bdpagetype:1
[+] = bdqid:0x9acb602d00001922
[[] = bduserid:0
)
*/
http://www.bkjia.com/PHPjc/767605.html www.bkjia.com true http://www.bkjia.com/PHPjc/767605.html techarticle wind up two ways, you can refer to/use: Copy the code as follows: #方式一 $ch = curl_init (' http://www.jb51.net '); curl_setopt ($ch, Curlopt_ Returntransf ...