The wind-driven arrangement of two ways, we can refer to/use:
Copy 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);
Mode two
Copy Code code as follows:
Print_r (
Get_headers (' http://www.baidu.com ')
);
#返回以下内容:
/*
Array
(
[0] => http/1.1 OK
[1] => Date:sun, May 2014 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 IND COM"
[9] => Cache-control:private
[A] => Expires:sun, May 2014 03:42:09 GMT
[One] => x-powered-by:hphp
[of] => server:bws/1.1
[A] => bdpagetype:1
[=>] bdqid:0x9acb602d00001922
[bduserid:0] =>
)
*/