PHP determines if remote pictures are valid
?
$url = "http://www.iteye.com/upload/logo/user/275746/46a4c886-427e-3554-b195-083430beb92a.jpg"; echo "$url
"; $arr = Get_headers ($url, 1); Echo $arr [" Content-type "]; Image/jpeg
The following are the manuals:
get_headers () returns an array that contains the headers sent by the server in response to an HTTP request. If it fails, it returns false and emits an e_warning level error message.
If the optional format parameter is set to 1, get_headers () parses the corresponding information and sets the array's key name.
??
$url = ' http://www.example.com ';p rint_r (get_headers ($url));p Rint_r (Get_headers ($url, 1));? > The output of the example above is similar to the following: Array ( [0] = http/1.1 + OK [1] = Date:sat, May 2004 12:28:13 GMT [2] = = Server: apache/1.3.27 (Unix) (red-hat/linux) [3] = last-modified:wed, Jan 2003 23:11:55 GMT [4] = = ETag: " 3f80f-1b6-3e1cb03b " [5] = Accept-ranges:bytes [6] = content-length:438 [7] = = Connection: Close [8] = content-type:text/html) Array ( [0] = http/1.1-OK [Date] = Sat, 2004 12:28 : + GMT [Server] = apache/1.3.27 (Unix) (red-hat/linux) [last-modified] = Wed, Jan 2003 23:11:55 GMT [ETag] = "3f80f-1b6-3e1cb03b" [accept-ranges] = bytes [content-length] = 438< C18/>[connection] = Close [Content-type] = text/html)