I am having problems connecting to ports from my php code.
This has worked for a couple of years.
I am on my own server, and have root ssh access.
I can telnet to my localhost 25 with no problem from ssh.
--
box1:~ # telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 box1.siteman.no ESMTP Postfix
--
I use this as a testscript on php:
<?php
$fp = fsockopen("localhost", 25, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
$out = "GET / HTTP/1.1\r\n";
$out .= "Host: $out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp)) {
echo fgets($fp, 128);
}
fclose($fp);
}
?>
--
I get this error on the testpage:
Warning: fsockopen() [function.fsockopen]: unable to connect to localhost:25 in / on line 2
Connection timed out (110)
This has worked for a couple of years.
I am on my own server, and have root ssh access.
I can telnet to my localhost 25 with no problem from ssh.
--
box1:~ # telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 box1.siteman.no ESMTP Postfix
--
I use this as a testscript on php:
<?php
$fp = fsockopen("localhost", 25, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
$out = "GET / HTTP/1.1\r\n";
$out .= "Host: $out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp)) {
echo fgets($fp, 128);
}
fclose($fp);
}
?>
--
I get this error on the testpage:
Warning: fsockopen() [function.fsockopen]: unable to connect to localhost:25 in / on line 2
Connection timed out (110)