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:
As you can see, we have tried variations of this XMLAPI but, they come back with the same result. Any thoughts on this delima?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"); ?>
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!



LinkBack URL
About LinkBacks
Reply With Quote





