Jump to content


Photo

Fsockopen $errno


  • Please log in to reply
1 reply to this topic

#1 superpimp

superpimp
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 22 April 2006 - 05:23 PM

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.
<?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;
}
?>

thx!

#2 KrisNz

KrisNz
  • Members
  • PipPipPip
  • Advanced Member
  • 271 posts
  • LocationAuckland, New Zealand

Posted 23 April 2006 - 02:50 AM

[!--quoteo(post=367491:date=Apr 23 2006, 03:23 AM:name=superpimp)--][div class=\'quotetop\']QUOTE(superpimp @ Apr 23 2006, 03:23 AM) View Post[/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.
<?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;
}
?>

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





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users