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.

XML-API for a Fullbackup working on my localhost, but not on server

Discussion in 'cPanel Developers' started by tranquillity, Sep 8, 2011.

  1. tranquillity

    tranquillity Registered

    Joined:
    Sep 8, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Reseller Owner
    Hi all.
    It's some days I'm trying to figure out this problem I encountered on my project.
    Let me say my cpanel account is on server1, my project is on server2
    When I call the xmlapi.php from the script in my localhost to do a fullbackup of a cpanel account of mine via ftp to server2, it works very well with no problem at all.
    However, when I put that script on server2 (not that of my cpanel account) and I try to do fullbackup from server1, I receive this message from curl: couldn't connect to host (error number 7).

    As well as I've done some tests to figure out where can be the problem and read many many posts in here I've not found something that could really let me know something useful to resolve it.

    Here's my script

    <?php
    include "xmlapi.php";
    $ip = "mycpaneldomain.it"; // my server ip address
    $cp_user = 'my_user'; // Cpanel username
    $cp_pass = 'my_pwd'; // Cpanel Password
    $auth_type = $cp_pass;
    $confirm_email = 'my_email@my_email.com'; // Email confirmation when the backup is done
    $remote_server = 'ftp.server1.com'; //Where you gonna remote the server? This could be in IP Address or hostname for remote server
    $remote_user = 'ftp_user@ftp.server1.com'; //FTP username
    $remote_pass = 'ftp_pwd';//FTP Password
    $remote_port = 21; //the default port for FTP
    $remote_dir = '/'; // The directory stored

    $xmlapi = new xmlapi($ip);
    $xmlapi->set_password($cp_user, $cp_pass);
    $xmlapi->set_port("2083");
    $xmlapi->password_auth($cp_user, $cp_pass);
    $xmlapi->set_debug(1);

    // Setup an ordinal array with arguments in proper order
    $args = array(
    'ftp', // Destination type
    $remote_server, // Remote destination address/domain
    $remote_user, // Destination's FTP user login
    $remote_pass, // Destination's FTP password login
    $confirm_email, // Email address to send notification
    $remote_port, // Listening FTP port on remote destination
    $remote_dir, // Directory to store backup on remote destination
    );

    // Make API1 query
    $xmlapi->api1_query($cp_user, "Fileman", "fullbackup", $args);


    ?>


    If I try this script on my server2 with cpanel accounts that have whm, port 2087 answers fast and ftp backup works. Also in my localhost.
    If I try this script on my server2 with cpanel accounts on port 2083/2082 the script doesn't work at all, returning me the curl error above. YET WORKS IN MY LOCALHOST.

    Moreover I've to say that this script ON SERVER 2 works with 2082/2083 only with 5% of my cpanel accounts.

    I'm struggling with that.

    I also tried other tests via ssh and I notice that traceroute isn't working for those domains for which the script doesn't work, returning me "operation not permitted" yet it works for that 5% of domains that I can backup up without problems. However my console understanding experience is limited to the mere knowledge of few commands.

    I don't know if there's a correlation between that things.

    I hope someone can help me. Thanks in advance.

    Alessandro

    UPDATE: if I try FROM MY SERVER2 fsockopen() to that host, and many others giving me problems, at ports 2082/2083/2086, fsockopen() returns me an error 110 - connection timed out. At port 2087 it works.
    Meanwhile, if I try FROM MY LOCALHOST fsockopen() to that host, and many others giving me problems, at ports 2082/2083/2086, fsockopen() returns me all ports work.
     
    #1 tranquillity, Sep 8, 2011
    Last edited: Sep 8, 2011
Loading...

Share This Page