Public feed
#600051
function my_get_headers($url) { $url_info=parse_url($url); if (isset($url_info['scheme']) && $url_info['scheme'] == 'https') { $port = 443; @$fp=fsockopen('ssl://'.$url_info['host'], $port, $errno, $errstr, 10); } else { $port = isset($url_info['port']) ? $url_info['port'] : 80; @$fp=fsockopen($url_info['host'], $port, $errno, $errstr, 10); } if($fp) { stream_set_timeout($fp, 10); $head = "HEAD ".@$url_info['path']."?".@$url_info['query']; $head .= " HTTP/1.0\r\nHost: ".@$url_info['host']."\r\n\r\n"; fputs($fp, $head); while(!feof($fp)) { if($header=trim(fgets($fp, 1024))) { $sc_pos = strpos( $header, ':' ); if( $sc_pos === false ) { $headers['status'] = $header; } else { $label = substr( $header, 0, $sc_pos ); $value = substr( $header, $sc_pos+1 ); $headers[strtolower($label)] = trim($value); } } } return $headers; } } $urls = explode("\n",$_GET['urls']); if(is_array($urls)) { foreach($urls as $url) { $data[] = my_get_headers($url); } print_r($data); }//Returns:Array( [0] => [1] => Array ( [status] => HTTP/1.1 200 OK [date] => Mon, 02 Jul 2007 16:27:26 GMT [p3p] => policyref="http://p3p.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV" [cache-control] => private [vary] => User-Agent [last-modified] => Mon, 02 Jul 2007 16:24:30 GMT [accept-ranges] => bytes [content-length] => 9463 [connection] => close [content-type] => text/html; charset=utf-8 ))