Re: PERL to PHP socket help
| From: | Clay Loveless | Date: | Wed, 19 Jun 2002 23:39:56 +0000 |
| Subject: | Re: PERL to PHP socket help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-103041@lists.php.net to get a copy of this message | ||
Unless you *really* need the functionality of the socket functions, you
could to this:
<?php
if(!$fp = fsockopen("65.255.558.22", 80, $errno, $errstr, 10)) {
die("Unable to connect: $errno $errstr");
} else {
// socket is open
// do your thing
fclose($fp);
}
?>
As an aside, it's unlikely that your SMTP port is port 80 at localhost! Much
more likely to be the default SMTP port of 25.
-Clay
> From: "Rob Packer" <robert@nrc.net>
> Organization: NRC
> Reply-To: "Rob Packer" <robert@nrc.net>
> Date: Wed, 19 Jun 2002 19:31:25 -0400
> To: php-general@lists.php.net
> Subject: [PHP] PERL to PHP socket help
>
> Can anyone translate this from PERL to PHP (if it's not too much fuss)?
>
> $remote = IO::Socket::INET->new(
> Proto => "tcp",
> PeerAddr => "65.255.558.22",
> PeerPort => "http(80)",
> Timeout => "10",
> ) || die ("Unable to connect to smtp
> port at localhost");
>
>
> I've seen the socket functions in the manual but thought someone might be
> able to clarify this a bit for me.
>
> Thanks for any efforts
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>