Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11
  1. #1
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Could not connect to http://ip:port/xxx

    with htt://domain.com........ is fine
    BUT
    To http://iport/xxx
    I tested file_get_contents , and SoapClient >> could not connect

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

  • #2
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,343
    Thanks
    60
    Thanked 527 Times in 514 Posts
    Blog Entries
    4
    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.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • #3
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?

  • #4
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,343
    Thanks
    60
    Thanked 527 Times in 514 Posts
    Blog Entries
    4
    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.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • #5
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    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

  • #6
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Fou-Lu View Post
    I don't think that PHP's http context wrappers accept an iport 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

  • #7
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    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.

  • #8
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?

  • #9
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    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?

  • #10
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Fou-Lu View Post
    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

  • #11
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Then there is your answer; it looks to me that the iport is rejected as an http port. So as I first suggested, create a tcp context instead and see if that works.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •