Hey guys. I'm working on a site right now and I'm trying to check a link's validity. I've gotten this far:
[codex]function checkLink($url, $dir)
{
if($sock=fsockopen($url,80))
{
fputs($sock, "HEAD $dir HTTP/1.0\r\n\r\n");
while(!feof($sock))
{
echo fgets($sock);
}
}
}[/codex]
Problem is, I can't figure out how to dump the fgets($sock); into a string. I just need to do that then compare the beginning of the string to another string and I should be fine.
Any ideas?