Jump to content

Archived

This topic is now archived and is closed to further replies.

superpimp

Fsockopen $errno

Recommended Posts

Is there a page where I can get an explation for fosockopen's $errno? I searched the php.net site and google but didnt found a thing.
When I echo $errstr, it's blank.
[code]
<?php
$host = "www.efzefrzefgoogle.com"; //zu prüfender host
$timeout = 10; //timeout in sekunden

if(@fsockopen($host, "80",$errno,$errstr,$timeout)) //prüfen, ob der host erreichbar ist, das @ unterdrückt fehlerausgabe
{
echo "<p>Online!</p>";
}
else
{
echo "<p>Offline!</p>".$errno;
}
?>
[/code]

thx!

Share this post


Link to post
Share on other sites
[!--quoteo(post=367491:date=Apr 23 2006, 03:23 AM:name=superpimp)--][div class=\'quotetop\']QUOTE(superpimp @ Apr 23 2006, 03:23 AM) [snapback]367491[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Is there a page where I can get an explation for fosockopen's $errno? I searched the php.net site and google but didnt found a thing.
When I echo $errstr, it's blank.
[code]
<?php
$host = "www.efzefrzefgoogle.com"; //zu prüfender host
$timeout = 10; //timeout in sekunden

if(@fsockopen($host, "80",$errno,$errstr,$timeout)) //prüfen, ob der host erreichbar ist, das @ unterdrückt fehlerausgabe
{
echo "<p>Online!</p>";
}
else
{
echo "<p>Offline!</p>".$errno;
}
?>
[/code]

thx!
[/quote]

In your code you're supressing error messages, Im not sure if that effects the error string being modified though. Also you aren't going to be able to do anything with your connection without getting the resource returned by fsockopen.

Try following the example code on the php.net page for fsockopen. php.net/fsockopen

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.