Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Member
    Join Date
    Sep 2007
    Posts
    30

    Question XMLAPI adding parked domain woes! help..

    I need some help or direction here on how to solve this puzzle. I own a hosting company and I have been wanting to automate some tasks for a while. One of the automation features I wanted was automatic parked domain creation so that users would have a temp/developer URL to use before taking their site live.

    We use WHMCS and I have created an action hook for this.

    What we're trying to automate:
    1. new account name = harryp, new account domain = willworklater.com
    (this will resolve after the client changes their DNS once their happy with the new site)

    2. live domain that resolves properly = workingdomain.com
    (belongs to another account we own, but is a working URL)

    If I use the WHM "Park A Domain" feature as root, I can park "harryp.workingdomain.com" on top of "willworklater.com" so the user can develop their site by using "harryp.workingdomain.com".

    I'm trying to use the XMLAPI 2 in a PHP script to do this but, I keep getting the error:
    The following domain is not configured for this account: willworklater.com (example domain)

    The PHP code I have slapped together is:
    Code:
    <?php //Park a domain for a new account
    	function createparkeddomain($vars) {
    //			print_r($vars);
    			$cpanel_user = $vars['params']['username'];
    			$cpanel_password = $vars['params']['password'];
    			$cpanel_domain = $vars['params']['domain'];
    			$cpanel_ip = $vars['serverip'];
    			$pdomain = $cpanel_user.".web-jive.com";
    
    			include_once('xmlapi.php');
    			$xmlapi = new xmlapi($cpanel_ip);
    			$xmlapi->set_port(2082);
    			$xmlapi->password_auth($cpanel_user,$cpanel_password);
    			$xmlapi->return_xml(1);
    			$xmlapi->set_debug(1);
    //			$args = array(domain => $pdomain); 
    //			print $xmlapi->api2_query($cpanel_user, 'Park', $args); 
    //			print $xmlapi->api2_query($cpanel_user, "Park", "park", array(newdomain=>$pdomain, topdomain=>$cpanel_domain));  
    //			print $xmlapi->api2_query($cpanel_user, 'Park', 'park', array( 'domain' => $pdomain, 'topdomain' => $cpanel_domain ) );
      
    			print $xmlapi->park($cpanel_user, $pdomain, $cpanel_domain);  
    
    }
    
    add_hook("AfterModuleCreate",1,"createparkeddomain");	
    
    ?>
    As you can see, we have tried variations of this XMLAPI but, they come back with the same result. Any thoughts on this delima?

    We stopped using mod_userdir a long time ago due to he security holes that opens up and, this is our way to easily solve this; to create parked domains.

    Thanks!
    Last edited by WebJIVE; 06-22-2011 at 09:21 AM. Reason: Updated title
    Eric Caldwell - CEO
    Web-JIVE.com
    Web design, Joomla Development and Hosting

  2. #2
    Member
    Join Date
    Sep 2007
    Posts
    30

    Default Re: XMLAPI adding parked domain woes!

    Wow.. no reply from cPanel?
    Eric Caldwell - CEO
    Web-JIVE.com
    Web design, Joomla Development and Hosting

  3. #3
    Member
    Join Date
    Sep 2007
    Posts
    30

    Default Re: XMLAPI adding parked domain woes!

    Ok, MANY thanks to John Kata fom cPanel support who helped me get this working. Couple of things, first you need to set cPanel to allow parking across domains:

    WHM -> Tweak Settings -> Domains -> Allow domain parking across accounts

    This is the line of code that got it working and John is going to get the API docs updated to reflect this.

    Code:
    print $xmlapi->api2_query($cpanel_user, 'Park', 'park', array('domain' => $pdomain));
    Thanks John Kata!
    Eric Caldwell - CEO
    Web-JIVE.com
    Web design, Joomla Development and Hosting

  4. #4
    Integration Developer cPanelDavidN's Avatar
    Join Date
    Dec 2009
    Location
    Houston, TX
    Posts
    525

    Default Re: XMLAPI adding parked domain woes!

    Hi Eric,

    Sorry I couldn't get to your post sooner. This doesn't address your exact problem, but...John got a hold of me and pointed out that there was a discrepancy in the xmlapi client class vs. the documentation vs. the behavior of API2 Park::park. The convenience method "park()" in the xmlapi PHP client class has been updated to reflect this. The xmlapi PHP client class is now version 1.0.11.

    Regards,
    -DavidN

    PS. The documentation for API2 Park::park should be updated shortly with more description concerning the 'topdomain' argument.
    David Neimeyer
    Integration Developer

    sdk.cpanel.net
    APIs: XML-API API1 & API2
    Check Out: Developer Downloads Integration Blog
    Need Support? Support Ticket Developer Forum Feature Request

  5. #5
    Member
    Join Date
    Sep 2007
    Posts
    30

    Default Re: XMLAPI adding parked domain woes!

    No worries. We got it figured out. I wanted to avoid using the unsecure temp URL method of mod_userdir for new sites and use parked domains. Once we set a setting in cPanel and corrected the API call, all is good.

    Now that I have that behind me, we can move on to more XMLAPI duties. Thanks for the PHP API library! Makes life a lot easier.
    Eric Caldwell - CEO
    Web-JIVE.com
    Web design, Joomla Development and Hosting

  6. #6
    Integration Developer cPanelDavidN's Avatar
    Join Date
    Dec 2009
    Location
    Houston, TX
    Posts
    525

    Default Re: XMLAPI adding parked domain woes!

    Glad that we could help!

    Another note to ALL:
    Opening a support ticket is a great way to get things resolved quickly, and it's a complimentary service available to all cPanel users. If it's a technical issue (that's been posted in the forum) that isn't getting the traction feel free to PM me and I will try to respond in a timely manner. [please keep in mind, we have holiday too!]

    Best Regards to ALL,
    -DavidN
    David Neimeyer
    Integration Developer

    sdk.cpanel.net
    APIs: XML-API API1 & API2
    Check Out: Developer Downloads Integration Blog
    Need Support? Support Ticket Developer Forum Feature Request

Similar Threads & Tags
Similar threads

  1. Trouble adding a parked domain
    By eulogy1337 in forum New User Questions
    Replies: 1
    Last Post: 03-24-2011, 02:42 PM
  2. Adding a Subdomain as Parked Domain
    By seikan in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 01-29-2009, 07:35 AM
  3. Adding Parked Domain
    By WilliamE in forum cPanel and WHM Discussions
    Replies: 8
    Last Post: 07-29-2007, 03:05 AM
  4. Problem In Adding Parked Domain ?!
    By SERVER X in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 11-13-2005, 09:39 AM
  5. how to ban client adding a certain domain as addon/parked domain
    By c9net in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 07-14-2003, 08:32 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube