Dear PHP Gurus:

I'm looking for a way to timeout an fopen function.  I'm doing some link checking 
inside of a for loop and some links "hang" rather than return a definitive "can't 
connect" or "can connect."  (Pardon the highly technical jargon there...)

In cases where my link hangs, I'd like to simply display a message (i.e., "hanging") 
and advance to the next loop.  

I have search the docs/forumns far and wide and can't find anything definitive.  As 
far as I can tell socket_set_timeout won't quite do what I want it to.

Any ideas?  Here's the important part of my code:

for ()
{
echo "Checking: $link : \n"; flush();
                        
                        $fp = @fopen($link, "r");
                        if (!$fp) { echo "<font class=linksred>The link is 
dead!</font>"; }
                        else { fclose($fp); echo "<font class=linksgreen>The link is 
working!</font>"; }
                        echo "<br><bR>";
                        
                        echo "</font>";
}

Thanks in advance!


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to