3

I'm trying to use fsockopen() to connect from my apache server to a remote API server. The remote server script I need to connect to runs on port 8080.

The following keeps returning a 101 connection timed out error:

$fp = fsockopen('remote.example.com', '8080', $errno, $errstr, 10);

Do I need to open port 8080 on my server in order to connect to that port on the remote server?

And if so, is there any way to do that using e.g. .htaccess, or would I have to modify httpd.conf for that?

Thanks!

ADDED

Thanks everybody for the replies. You were all correct, but I can only accept 1 answer, so I accepted the first one.

If anyone is interested: this is on a Wiredtree server and after emailing support, they said that they have that disabled by default for security reasons (also cURL), but they can enable it upon request. I'm sure that once they do, this problem will be solved.

Thought I'd post this in case anyone else is experiencing the same problem in the future.

Matt1
  • 33
  • 4

3 Answers3

1

No, You need not. When you connect to another server, your server is being the client, and the client's port number is chosen from the dynamic port range.

xdazz
  • 158,678
  • 38
  • 247
  • 274
0

Generally speaking, all ports are open going outwards unless explicitly blocked. I think there's something else at play here. Is the remote API server running? Is it indeed running on port 8080 and can you check? Have you tried to connect using telnet to port 8080?

Moo-Juice
  • 38,257
  • 10
  • 78
  • 128
0

No, you do not have to open your server's 8080 port. Are you in a corporate or government setting where you might be sitting behind a proxy server? If so you might not be able to reach that destination without going through the proxy.

davidethell
  • 11,708
  • 6
  • 43
  • 63
  • I'm not behind a proxy - it's a normal Apache server. How could I check if port 8080 is open for outbound traffic? – Matt1 Oct 26 '11 at 10:29