stream_set_timeout doesnt timeout

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

stream_set_timeout doesnt timeout

Post by anjanesh »

Code: Select all

$domain = "xxx.com";
$whois = "cwhois1.completewhois.com";
stream_set_timeout($fp, 2);
$fp = fsockopen($whois, 43, $errno, $errstr, 5);
This never ends and Im not able to get a timeout mechanism to check the domain from another whois server.

How I get the timeout ?

Thanks
Syranide
Forum Contributor
Posts: 281
Joined: Fri May 20, 2005 3:16 pm
Location: Sweden

Post by Syranide »

It's kinda hard settings timeout on something that doesn't exist.

You have to set it on the handle you get, but if I'm not mistaken, fsockopen does take a timeout-param? (which you might've set... but anyway)
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

xxx.com is to be searched from whois.opensrs.net but I woulnt know that initally so I check with some 3-4 whois servers until I get the whoisinfo.

But I cannot get past cwhois1.completewhois.com and continue with the rest of the whois servers because xxx.com with cwhois1.completewhois.com is going on forever.
Syranide
Forum Contributor
Posts: 281
Joined: Fri May 20, 2005 3:16 pm
Location: Sweden

Post by Syranide »

What I meant was that you set the timout on $fp ... which is NULL ... NULL might timeout, not to my knowledge though ;)

Then you overwrite it with a socket.
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

I did try having stream_set_timeout($fp, 2); after $fp = fsockopen($whois, 43, $errno, $errstr, 5); - no effect !
Syranide
Forum Contributor
Posts: 281
Joined: Fri May 20, 2005 3:16 pm
Location: Sweden

Post by Syranide »

but that's because it doesn't come to that point :P
but anyway, you have a timeout for fsockopen, which should timeout, however I don't know why it doesn't work, I believe I've had problems with it myself.
Post Reply