Hi, i am a complete newbie to this and i'm really struggling with how to get started.
I want to be able to add databases, users and subdomains using php.
I have had a look through the documentation for using the API and one of the first things it says to do is an authentication test, in php this looks like:
I have filled out the username, password and query fields and when i run the file i don't receive any response. What should the result print out if this has been sucessful? Also if not successful should i receive an error?Code:$whmusername = "username"; $whmpassword = "password" $query = "https://127.0.0.1:2087/"; $curl = curl_init(); # Create Curl Object curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,0); # Allow self-signed certs curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,0); # Allow certs that do not match the hostname curl_setopt($curl, CURLOPT_HEADER,0); # Do not include header in output curl_setopt($curl, CURLOPT_RETURNTRANSFER,1); # Return contents of transfer on curl_exec $header[0] = "Authorization: Basic " . base64_encode($whmusername.":".$whmpassword) . "\n\r"; curl_setopt($curl, CURLOPT_HTTPHEADER, $header); # set the username and password curl_setopt($curl, CURLOPT_URL, $query); # execute the query $result = curl_exec($curl); if ($result == false) { error_log("curl_exec threw error \"" . curl_error($curl) . "\" for $query"); # log error if curl exec fails } curl_close($curl); print $result;
One more thing do i need to download anything?
sorry its such a basic question but i'm getting nowhere fast.
Thanks,
Rebecca



LinkBack URL
About LinkBacks
Reply With Quote




