问题
I have a dedicated server running a MSSQL and an apache server, only listening to port 8080 (the apache), and i have some XML in there that i want to access from another domain(hosted server).
I tried fsockopen like this:
<?php
$fp = fsockopen("199.175.125.222", 8080, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
$out = "GET / HTTP/1.1\r\n";
$out .= "Host: www.example.com\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp)) {
echo fgets($fp, 128);
}
fclose($fp);
}
?>
but got nothing, only a:
Warning: fsockopen() [function.fsockopen]: unable to connect to 199.175.125.222:8080 (Connection timed out) in /home/reb/public_html/testing/index.php on line 2 Connection timed out (110)
php_sockets is enabled and all... Any ideas? now im trying WAMP on this dedicated server, to see if any config may help
Thank you
来源:https://stackoverflow.com/questions/8004140/php-connect-to-external-ip-with-port