Php to obtain the implementation code of the http status. There are two ways to sort out the data one by one. you can refer to the following code: # Method 1 $ chcurl_init (www.jb51.net); curl_setopt ($ ch, CURLOPT_RETURNTRANSF two ways to sort out the data one by one, for your reference/use:
The code is as follows:
# Method 1
$ 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 );
Method 2
The code is as follows:
Print_r (
Get_headers ('http: // www.baidu.com ')
);
# Return the following content:
/*
Array
(
[0] => HTTP/1.1 200 OK
[1] => Date: Sun, 04 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 = bytes: 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
[10] => Expires: Sun, 04 May 2014 03:42:09 GMT
[11] => X-Powered-By: HPHP
[12] = & gt; Server: BWS/1.1
[13] => BDPAGETYPE: 1
[14] => BDQID: 0x9acb602d20171922
[15] => BDUSERID: 0
)
*/
The authorization code is as follows: # Method 1 $ ch = curl_init ('http: // www.jb51.net'); curl_setopt ($ ch, CURLOPT_RETURNTRANSF...