SOLVED Need help with xmlapi.php usage

mcSison

Registered
Sep 6, 2017
4
1
3
Philippines
cPanel Access Level
Root Administrator
Good day,

Our team has encountered a hitch with our newly created test server in which we are trying to create a subdomain using xmlapi.php that uses functions such as api1_query() to create the subdomain, this method works with our older server. However upon trying the same on our new server we can't seem to create a subdomain. We are able to create a subdomain manually by going to the subdomains screen. upon checking that xmlapi.php created an error log that looks like this:

Code:
[06-Sep-2017 05:16:54 UTC] URL: [URL]https://$CPANEL_USER.com:2083/json-api/cpanel[/URL]
[06-Sep-2017 05:16:54 UTC] DATA: dir=%2Fpublic_html%2Fsecured%2Fmcs&rootdomain=$CPANEL_USER.com&subdomain=test&user=$CPANEL_USER&cpanel_xmlapi_module=SubDomain&cpanel_xmlapi_func=addsubdomain&cpanel_xmlapi_apiversion=2
[06-Sep-2017 05:16:54 UTC] Authentication Header: Authorization: Basic cmFjZXRvMWI6cmFjZS0xMjM=


[06-Sep-2017 05:19:02 UTC] PHP Fatal error:  Uncaught exception 'Exception' with message 'curl_exec threw error "Failed to connect to $CPANEL_USER.com port 2083: Connection timed out" for [URL='https://$CPANEL_USER.com:2083/json-api/cpanel?dir=%2Fpublic_html%2Fsecured%2Fmcs&rootdomain=$CPANEL_USER.com&subdomain=test&user=$CPANEL_USER&cpanel_xmlapi_module=SubDomain&cpanel_xmlapi_func=addsubdomain&cpanel_xmlapi_apiversion=2']https://$CPANEL_USER.com:2083/json-api/cpanel?dir=/public_html/secured/mcs&rootdomain=$CPANEL_USER.com&subdomain=test&user=$CPANEL_USER&cpanel_xmlapi_module=SubDomain&cpanel_xmlapi_func=addsubdomain&cpanel_xmlapi_apiversion=2[/URL]' in /home/$CPANEL_USER/public_html/secured/cpanel/xmlapi.php:693
Stack trace:
#0 /home/$CPANEL_USER/public_html/secured/cpanel/xmlapi.php(615): xmlapi->curl_query('[URL]https://raceto1[/URL]...', 'dir=%2Fpublic_h...', 'Authorization: ...')
#1 /home/$CPANEL_USER/public_html/secured/cpanel/xmlapi.php(814): xmlapi->xmlapi_query('cpanel', Array)
#2 /home/$CPANEL_USER/public_html/secured/cpanel/index.php(41): xmlapi->api2_query('$CPANEL_USER', 'SubDomain', 'addsubdomain', Array)
#3 {main}
  thrown in /home/$CPANEL_USER/public_html/secured/cpanel/xmlapi.php on line 693
in which $CPANEL_USER is the username/host name. I have browsed the internet for anything related to our concern with no luck, being a beginner in development operations I still lack the knowledge to resolve such issues and would greatly appreciate any help from the community. thank you...
 
Last edited by a moderator:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,203
363
Code:
[06-Sep-2017 05:19:02 UTC] PHP Fatal error: Uncaught exception 'Exception' with message 'curl_exec threw error "Failed to connect to $CPANEL_USER.com port 2083: Connection timed out" for https://$CPANEL_USER.com:2083/json-api/cpanel?dir=/public_html/secured/mcs&rootdomain=$CPANEL_USER.com&subdomain=test&user=$CPANEL_USER&cpanel_xmlapi_module=SubDomain&cpanel_xmlapi_func=addsubdomain&cpanel_xmlapi_apiversion=2' in /home/$CPANEL_USER/public_html/secured/cpanel/xmlapi.php:693
Hello,

Can you verify connection requests to the domain name in-question over port 2083 are working when tested manually? Do you have any firewall rules that are restricting access to port 2083?

Thank you.
 

mcSison

Registered
Sep 6, 2017
4
1
3
Philippines
cPanel Access Level
Root Administrator
Hello,

Can you verify connection requests to the domain name in-question over port 2083 are working when tested manually? Do you have any firewall rules that are restricting access to port 2083?

Thank you.
Hi,

Thank you for your reply, it would seem that it is a fire wall issue. I do not know the details since I am not the managing our firewalls but when I told our TechOps Team what you said and they were able to fix the issue immediately. Thank you very much.
 
  • Like
Reactions: cPanelMichael

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,203
363
Hello,

I'm glad to see the issue is now solved. Thank you for updating us with the outcome.