can't get fsockopen() to work through IIS
| From: | Evan Burkitt | Date: | Fri, 17 Oct 2008 20:17:26 +0000 |
| Subject: | can't get fsockopen() to work through IIS | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-29045@lists.php.net to get a copy of this message | ||
I have PHP 5.2.6 installed under Windows Server 2003 and IIS 6.0. I cannot
get fsockopen() to succeed when run through IIS.
I'm using this script:
<?php
$host = "localhost";
$port = "110";
?>
<html>
<h1>Attempting to open socket on host '<?php echo ("$host")?>' at
port
'<?php echo ("$port")?>'</h1>
<h2>
<?php
$errno = 0;
$errstr = "<no error reported>";
$fp = @fsockopen($host, $port, $errno, $errstr);
if ($fp) {
echo "Socket connection established";
fclose($fp);
}
else {
echo "Could not connect to $host at port $port (\$errno=$errno;
\$errstr=$errstr)";
}
?>
</h2>
</html>
When I run it through a Web browser $fp is null, $errno is 0 and $errstr is
empty. When I run it from a command line, using the IIS Internet user's
credentials, the connection succeeds and $fp is non-null.
I would appreciate any suggestions.