...

View Full Version : Could not connect to http://ip:port/xxx



tho1
01-05-2012, 11:39 AM
with htt://domain.com........ is fine
BUT
To http://ip:port/xxx
I tested file_get_contents , and SoapClient >> could not connect

Any one know this issue? Is it caused by server config?

tangoforce
01-05-2012, 02:34 PM
Have you tried with cURL?

file_get_contents() isn't 100% reliable for http connections. I stopped using it that way moons ago for anything other than a very basic url.

Anything on a different port or with ?x=y etc, I use cURL for.

tho1
01-05-2012, 02:45 PM
I tested CURL, and No lucky.
I got this issue on some host. Some others host and localhost working perfect

http://ip : port/abc.html don't work
http://abc.com/abc.html work perfect

Is it by firewall?

tangoforce
01-05-2012, 03:20 PM
Possibly yes but normally firewalls are pretty flexible about outgoing http requests on different ports - at least personal firewalls and routers. I suppose a datacentre firewall may be stricter. The only way to know for sure is to contact your host.

Fou-Lu
01-05-2012, 07:55 PM
I don't think that PHP's http context wrappers accept an ip:port pair. Use a socket instead using the socket contexts.
Refer to this section in the manual for sockets: http://ca.php.net/manual/en/function.socket-connect.php

tho1
01-06-2012, 06:28 AM
I don't think that PHP's http context wrappers accept an ip:port pair. Use a socket instead using the socket contexts.
Refer to this section in the manual for sockets: http://ca.php.net/manual/en/function.socket-connect.php

Why on local, and some host i can connect by that function?
at this situation, I need to use soapclient

Fou-Lu
01-06-2012, 07:05 AM
Just tested and it does appear that http context will accept a port. Don't know why it would bother though; pretty much any location configured with an alternate port to 80 isn't designed to be used as an actual website, so it shouldn't be expected to find a webserver on an alternate port.
Same goes for soap client. Tested fine with port 80, but as expected won't work on any other port.
So, if you are connecting using: http://123.231.1.14:80 for example to connect to example.com. If it fails to connect, then double check the address. If the port is not 80, its highly probable that your protocol should not be http.

tho1
01-06-2012, 12:31 PM
my url is http://xx:9090/xxxx/services/Services?wsdl
Im sure i enter it into browser and it show good
I tested on localhost and file_get_contents, curl, soap also show good
I also shared your reply. But i also have many url like http://ip: not80
Maybe xx:9090 is only a alias, xx:9090:80

Is it caused by a server config or other things?

Fou-Lu
01-06-2012, 02:47 PM
If it answers on port 9090, than it should be configured as an httpd server on port 9090. What is the error it gives you when constructing a soap client?

tho1
01-06-2012, 02:51 PM
If it answers on port 9090, than it should be configured as an httpd server on port 9090. What is the error it gives you when constructing a soap client?
wait for long time and it show blank
the log : could not connect to host

Fou-Lu
01-06-2012, 03:42 PM
Then there is your answer; it looks to me that the ip:port is rejected as an http port. So as I first suggested, create a tcp context instead and see if that works.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum