[thelist] php help

Arthur Noel arthur at arthurnoel.com
Tue Dec 12 07:12:29 CST 2000


Hi,
Can anyone tell me whats wrong with the below? It should take a URL as an
argument and return the header if its there but doesn't seem to work. Where
have I gone wrong?

function url_check($url) {
	$url_array = parse_url($url);
	$fp = fsockopen($url_array[host], 80);
	if (!$fp) return false;
	$abs_url = "http://$url_array[host]$url_array[path]";
	$query = "GET $abs_url HTTP/1.0\r\n".
					"Host: $url_array[host]:80\r\n".
					"User-agent: bot".
					"\r\n";
	fputs($fp, $query);
	$header = trim(fgets($fp, 1024));
	return $header;
	}

TIA,
Arthur





More information about the thelist mailing list