开发者

fsockopen, can't get a foot in! Connection timeout

开发者 https://www.devze.com 2023-04-04 01:02 出处:网络
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 webhos

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 miss开发者_运维百科ing? 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)


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
0

精彩评论

暂无评论...
验证码 换一张
取 消