/** Get website logo*/functionGet_url_ico ($url){ $url _arr=Parse_url($url); if(!$url _arr[' Scheme ']){ $url. = "http://"; } $url _arr=Parse_url($url); $url=$url _arr[' Scheme ']. ":/ /".$url _arr[' Host ']; if(Url_exists ($url)){ $api _url= "http://g.soz.im/{$url}/cdn.ico "; $ico=$url." /favicon.ico "; if(Remote_file_exists ($ico)){ return $ico; }ElseIf(Remote_file_exists ($api _url)){ return $api _url; }Else{ return false; } }Else{ return false; }}/** Determine if the URL exists*/functionUrl_exists ($url) { $head= @get_headers($url); return Is_array($head) ?true:false; }/** Determine if a remote file exists*/functionRemote_file_exists ($url) { $executeTime=Ini_get(' Max_execution_time '); Ini_set(' Max_execution_time ', 0); $headers= @get_headers($url); Ini_set(' Max_execution_time ',$executeTime); if($headers) { $head=Explode(‘ ‘,$headers[0]); if( !Empty($head[1]) &&intval($head[1]) < 400)return true; } return false;}
PHP Get website ico