email = $email; $this->apikey = $apikey; $this->url = 'http://www.boxis.biz/xmlapi.php'; } public function call($apitype, $command, $params){ $this->params = $params; $this->params['version'] = self::VERSION; $this->params['username'] = $this->email; $timestamp = time(); $this->params['timestamp'] = $timestamp; $this->params['authcode'] = md5($timestamp. $this->apikey); $this->params['section'] = $apitype; $this->params['action'] = $command; $ch = curl_init(); $post = ''; foreach($this->params as $k => $v) { $post .= $k.'='.urlencode(is_array($v) ? serialize($v) : $v).'&'; } $chOptions = array ( CURLOPT_URL => trim ($this->url), CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_TIMEOUT => 90, CURLOPT_POST => true, CURLOPT_POSTFIELDS => trim($post, '&') ); $chOptions[CURLOPT_USERPWD] = 'user:password'; // htaccess username and password curl_setopt_array($ch, $chOptions); $out = curl_exec($ch); curl_close($ch); return $out; } } /* API LOGIN DETAILS */ $email = 'your@email.com'; // your username $apikey = '1234567890'; // your apikey /* API COMMAND DETAILS */ $apitype = 'domains'; $command = 'register'; $params = array( 'returntype' => 'xml', // xml or json 'domain' => 'test1.com', 'years' => 2, 'ns' => array('203.234.12.34', '88.23.23.44'), 'protect-privacy' => 1 ); /* PROCESS THE ACTION */ $boxisAPI = new BoxisAPIConnection($email, $apikey); $return = $boxisAPI->call($apitype, $command, $params); /* RETURNED VALUE */ print_r($return); ?>