HTTP Header http://web-sniffer.net/ you can grab http headers of websites from here. And i want to grab this myself.
<?php $url = 'http://www.youtube.com/watch?v=B8H29jU8Wrs'; echo "<pre>"; print_r(get_headers($url, 1)); ?> PHP:
function get_headers_x($url,$format=0, $user='', $pass='', $referer='') { if (!empty($user)) { $authentification = base64_encode($user.':'.$pass); $authline = "Authorization: Basic $authentification\r\n"; } if (!empty($referer)) { $refererline = "Referer: $referer\r\n"; } $url_info=parse_url($url); $port = isset($url_info['port']) ? $url_info['port'] : 80; $fp=fsockopen($url_info['host'], $port, $errno, $errstr, 30); if($fp) { $head = "GET ".@$url_info['path']."?".@$url_info['query']." HTTP/1.0\r\n"; if (!empty($url_info['port'])) { $head .= "Host: ".@$url_info['host'].":".$url_info['port']."\r\n"; } else { $head .= "Host: ".@$url_info['host']."\r\n"; } $head .= "Connection: Close\r\n"; $head .= "Accept: */*\r\n"; $head .= $refererline; $head .= $authline; $head .= "\r\n"; fputs($fp, $head); while(!feof($fp) or ($eoheader==true)) { if($header=fgets($fp, 1024)) { if ($header == "\r\n") { $eoheader = true; break; } else { $header = trim($header); } if($format == 1) { $key = array_shift(explode(':',$header)); if($key == $header) { $headers[] = $header; } else { $headers[$key]=substr($header,strlen($key)+2); } unset($key); } else { $headers[] = $header; } } } return $headers; } else { return false; } } $response = get_headers_x($url, 1); PHP:
And here I was thinking that with a single request, you normally only got one status header back. If you want a 303, don't you have to basically trick the server in to returning one? I mean, you can't just point at a random server and expect a particular status header to come back, right?