SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Member
    Join Date
    Jun 2009
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Curl access to alternate port

    My environment: LINUX 2.6.9 Fedora Core 7
    Apache 2.2
    PHP 5.2.6
    Godaddy shared hosting
    & Godaddy dedicated virtual hosting
    (problem exists on both servers)

    I am having difficulty using CURL to access a remote server on a non-standard port. I am new to this forum and until I have 1o posts, I cannot post urls, so the following urls have the word 'slash''slash' substitued.

    Example: The url (http:'slash'slash'socket.carfax.com:8080) should should return the following: "901 Transaction Error". Type it into a browser address window and it returns the desired result.

    The following php script attempts to do the same via CURL, three different ways. All return the same result....nothing....

    <?
    $ch = curl_init();
    curl_setopt ($ch, CURLOPT_URL, "http:'slash'slash'socket.carfax.com/");
    curl_setopt ($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_PORT, '8080');
    $res = curl_exec($ch);
    curl_close ($ch);

    echo ("results of test #1=$res<br>");



    $ch = curl_init();
    curl_setopt ($ch, CURLOPT_URL, "http:'slash'slash'socket.carfax.com/");
    curl_setopt ($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_PORT,8080);
    $res = curl_exec($ch);
    curl_close ($ch);

    echo ("results of test #2=$res<br>");



    $ch = curl_init();
    curl_setopt ($ch, CURLOPT_URL, "http:'slash'slash'socket.carfax.com:8080/");
    curl_setopt ($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $res = curl_exec($ch);
    curl_close ($ch);
    echo ("results of test #3=$res<br>");

    ?>

    Does anyone have any suggestions what I am doing wrong. I'm not very familar with CURL but it appears quiet straightforward.

    Also if someone with Godaddy hosting could test the script and post the results, it would help me eliminate possibilities.

    Thanks in advance.
    Bill

  2. #2
    Floridiot joebert's Avatar
    Join Date
    Mar 2004
    Location
    Kenneth City, FL
    Posts
    823
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know if it applies to anything other than shared hosting, but Godaddy shared hosting has all outgoing ports other than 80 blocked by their firewall.

  3. #3
    SitePoint Member
    Join Date
    Jun 2009
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You should ask your admin to enable curl
    eYeew! Founder and Developer

    Madipta

  4. #4
    SitePoint Member
    Join Date
    Jun 2009
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the comments.


    RE Enabling Curl. Curl is enabled, and I use it okay for other functionality. This problem is occurring due to my need to send to a specific port on the remote server.

    RE port blocking by Godaddy. I'm do not know a lot in this area, so my question is this:

    I am sending a request to a 3rd party server specifying port 8080. I thought that meant that the 3rd party server will receive it on port 8080. Does it also mean that I am sending it out through port 8080 on my server?

    Thanks again.
    Bill

  5. #5
    Floridiot joebert's Avatar
    Join Date
    Mar 2004
    Location
    Kenneth City, FL
    Posts
    823
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am sending a request to a 3rd party server specifying port 8080. I thought that meant that the 3rd party server will receive it on port 8080. Does it also mean that I am sending it out through port 8080 on my server?
    No, you right. It means the destination address receives the request on port 8080.

    The problem is that Godaddy shared hosting will not let you make requests from your site that go to any port other than 80.

    It's like having a house where all of the doors and windows, except the front door, are welded shut.

    You'll have to contact Godaddy support and ask them if the dedicated packages have the same restrictions on ports as shared packages have, I don't know if they do.

  6. #6
    SitePoint Member
    Join Date
    Jun 2009
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Resolved - Talked to Godaddy Support and was told port 8080 is blocked, even on their dedicated servers. (I was told I had complete control of my leased server when I signed up...guess that isn't quite so).

    Thanks for your advice.

    Bill

  7. #7
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by freedbill View Post
    ...(I was told I had complete control of my leased server when I signed up...guess that isn't quite so).

    Thanks for your advice.

    Bill
    The Routers, Switches, and Firewalls are not part of the server. Hence you don't have control over those nor are you entitled to. Just pointing that out, FYI.

    Anyways, could use a proxy that would forward port 80 request to port 8080 or whatever.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  8. #8
    Floridiot joebert's Avatar
    Join Date
    Mar 2004
    Location
    Kenneth City, FL
    Posts
    823
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I had the same problem when an old buddy wanted to integrate the userlist from his teamspeak server and the stats from his UT server into his Godaddy-hosted website.

    From my experience, Godaddy hosting is good for serving static HTML, and small applications with low numbers of concurrent users. That's it.


Bookmarks

Posting Permissions

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