Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Curl connection issue

Discussion in 'General Discussion' started by Datalab, Feb 3, 2017.

Tags:
  1. Datalab

    Datalab Registered

    Joined:
    Dec 29, 2016
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Minnesota
    cPanel Access Level:
    DataCenter Provider
    Hi guys, im new in the forum and a granpa in Cpanel. i have a dedicated running proxmox with 2 VPS in there both with WHM Cpanel. im using CSF as firewall in both servers and the proxmox firewall disabled at the moment. in one of the servers i have WHMCS billling and automation script. i run a curl connection from server A (that has the WHMCS) to itself and works just fine, when i run the same curl to the server B then i get connection Curl Error: Failed to connect to <IP>:2087, Network is unreachable, where <IP>= my server IP and 2087 the port. Everything works just fine from the browser, ips are in Whitelist in cphulk and all allowed in both CSF.

    here is a test script i wrote to make sure the issue is not from WHMCS:

    Code:
    <?php
    
        $whmcsurl = "https://<IP>:2087";
    
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $whmcsurl);
        curl_setopt($ch, CURLOPT_TIMEOUT, 30);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        $data = curl_exec($ch);
    
       if (curl_error($ch)) {
           echo "Curl Error: ".curl_error($ch)."<br /><br />";
       } elseif (!$data) {
            echo "Empty Data Response - Please check CURL Installation<br /><br />";
        }
    
       curl_close($ch);
      
       echo "Connection Response (this should be a response from $whmcsurl when working correctly):<br /><br /><textarea rows=\"20\" cols=\"120\">$data</textarea>";
    
    ?>
    
    i run this script in both servers trying to o a test but no luck.

    Please NOTE that curl is installed in both servers.

    I really need some assistant here cause im losing my mind!
     
    #1 Datalab, Feb 3, 2017
    Last edited by a moderator: Feb 3, 2017
  2. NOC_Serverpoint

    NOC_Serverpoint Well-Known Member

    Joined:
    Jul 3, 2016
    Messages:
    102
    Likes Received:
    6
    Trophy Points:
    18
    cPanel Access Level:
    Website Owner
    Hi,

    Please try to curl verbose option while running the script to see were exactly it is getting broken,

    curl -v or curl --trace filename

    Regards,
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,427
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    You can try verifying the connection from the ServerA to ServerB completes successfully using telnet. For example, you'd run a command like this from ServerA:

    Code:
    telnet serverB 2087
    Thank you.
     
Loading...

Share This Page