Re: can't get fsockopen() to work through IIS
| From: | Elizabeth M Smith | Date: | Fri, 17 Oct 2008 21:46:32 +0000 |
| Subject: | Re: can't get fsockopen() to work through IIS | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-29046@lists.php.net to get a copy of this message | ||
Evan Burkitt wrote:
> 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.
>
>
Take out the @ in front of fsockopen and see what the actual error is
would be the first step - it's generally a good idea to have E_ALL on
and all @ operators removed when trying to debug something
Thanks,
Elizabeth Smith