Forum Moderators: coopster
any suggestions would be appreciated.
Cheers
Linda
my host seems to not execute that properly, maybe they dont have fsockopen()
if you're using win9x, fsockopen does not work well. this bug is known and describben in the php documentation.
in general it's good to know what does not work in detail.
if you're not able to connect to another server then maybe it's blocked by the firewall of your hosting company / server or the counterpart. can you validate this with other (non-php) tools?
or does the function not exist at all and you'll a get php error message? modify the error-settings to get a detailed error/warning message, here is how:
error_reporting(E_ALL);
maybe then it's easier to find out what is going wrong.
- hakre.
i seem to get this message:
Fatal error: Call to undefined function: ()
the name of the function is not displayed? then maybe this function has been disabled with your php version. is it your server? can you verify if safemode is on or off or which functions are disabled? maybe with phpinfo() or ini_get() [de2.php.net].
$fp = $fsockopen($ip,$port);
remove the $ in front of
fsockopen, otherwise the function named by the value of the variable $fsockopen will be called which is empty and produces the error message. for more info read about variable functions [de.php.net] in php.
this should help! ;)
image1.gif is shown if the fsockopen function was able to open a socket connection to the port on the host specified by the ip-address. for example, if port 80 is opened, often there is a webserver running (www-service).
the other image is shown if the connection fails.
you can read more about fsockopen at http://www.php.net/fsockopen [php.net].
in short ;) :
status up.
- hakre.
you can specify how long fsockopen will try to connect until timeout (of the socket opening, not the script ;) ):
int fsockopen ( string target, int port [, int errno [, string errstr [, float timeout]]])
in your case:
$fp = fsockopen($ip,$port,$errno,$errstr,30);
tries to connect for 30 seconds.