Question

Excuse my terrible pun.

Basically, the deal is, the host is being a bitch. A simple fsockopen script, no matter what port, server, or anything, will connect. Trying to get server help from the webhost (due to unfortunate circumstances I have no way of changing hosts) proved ineffective... bunch of morons. A simple phpinfo() shows, however, that allow_url_fopen is on and Registered Stream Socket Transports allows me tcp, udp, unix, udg, ssl, sslv3, sslv2, tls.

So, what am I missing? Does it sound like the host is discreetly blocking socket connections? I mean, even port 80 doesn't work:

Warning: fsockopen() [function.fsockopen]: unable to connect to www.google.com:80 (Connection timed out)

Was it helpful?

Solution

Provided you are calling fsockopen correctly (you don't show code), that error is implying that yes, they are restricting you from making outbound connections.

$fp = fsockopen("www.google.com", 80, $errno, $errstr, 30);
if (!$fp) {
    echo "$errstr ($errno)<br />\n";
}

If you have shell access, try using telnet and you should see the same result:

telnet www.google.com 80
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top