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.

couldn't connect to host via xmlapi api1_query function

Discussion in 'cPanel Developers' started by msandro, Jan 23, 2014.

  1. msandro

    msandro Registered

    Jan 23, 2014
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Website Owner
    I'm struggling to find out what is causing the following error message, when I try to create a new database via the xmlapi function $createdb = $xmlapi->api1_query($cpaneluser, "Mysql", "adddb", array($databasename)):

    Fatal error: Uncaught exception 'Exception' with message 'curl_exec threw error "couldn't connect to host" for' in /home/sistemas/public_html/swl-admin/app/controllers/xmlapi.php:848 Stack trace: #0 /home/sistemas/public_html/swl-admin/app/controllers/xmlapi.php(746): xmlapi->curl_query('https://67.205....', 'cpanel_xmlapi_u...', 'Authorization: ...') #1 /home/sistemas/public_html/swl-admin/app/controllers/xmlapi.php(970): xmlapi->xmlapi_query('cpanel', Array) #2 /home/sistemas/public_html/swl-admin/app/controllers/clientes_controller.php(801): xmlapi->api1_query('sistemas', 'Mysql', 'adddb', Array) #3 /home/sistemas/public_html/swl-admin/system/system.php(106): Clientes->replicar() #4 /home/sistemas/public_html/swl-admin/index.php(23): System->run() #5 {main} thrown in /home/sistemas/public_html/swl-admin/app/controllers/xmlapi.php on line 848

    The code was working perfectly until two weeks ago, and nothing has changed in the code to produce this error message.

    In the xmlapi code for the url, the security token (cpsessxxx) is not present, but since the variable $ENV{'cp_security_token'} is null, I thing that the problem is something else.

    It will be great if someone can help me with this.

    Thanks in advance.

    Mário Sandro.
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Apr 11, 2011
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator
    Hello :)

    I suggest checking the firewall on the remote server to make sure the source server is not blocked. You may also want to whitelist the IP address of the source server.

    Thank you.

Share This Page