Jump to content

Domainwhois API Call returns nothing


gknight

Recommended Posts

I have done everything to get this working, but for some reason, I get absolutely NOTHING back from the server when I make the API calls. Here is the code that I have :

 

if(isset($_REQUEST['domaincheck']))
{
$response = checkDomain($_REQUEST['domaincheck']);
echo $response;
}

function checkDomain($domain)
{
$url = "https://www.domaintowhmcsdirectory.com/includes/api.php";
$username = "MyUsername";
$password = "MyPassword";

$postfields["username"] = $username;
$postfields["password"] = md5($password);
$postfields["action"] = "domainwhois";
$postfields["domain"] = $domain;

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
   curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$data = curl_exec($ch);
if(curl_exec($ch) == false)
	echo curl_error($ch);
curl_close($ch);

$data = explode(";",$data);
foreach($data as $temp) {
	$temp = explode("=",$temp);
	$results[$temp[0]] = @$temp[1];
}

if ($results["status"]=="available") {
	$response = "available";
} else {
	$response = "taken";
}

return $results["status"];
}

 

It worked just fine a couple of days ago and now it just doesn't work at all.

Any help would be appreciated.

Link to comment
Share on other sites

Ok. Lets go through this again. Maybe I am not clarifying what the problem is.

 

If you enter "http://www.darkknighthosting.com/members/includes/api.php" directly into your browser address bar, you get the expected error of "result=error;message=Invalid IP XX.XXX.XX.XXX;" (the X's being my IP address since I am copying and pasting from the browser). The function that uses the cURL call the that SAME URL is listed above. I changed some of the stuff for safety reasons but all that needed to be changed was the username and password really). But the function returns a $)$ Page Not Found in the browser stating that it is on http://www.darkknighthosting.com at the bottom of the default Apache 404 page and in the top it even says that "/members/includes/api.php" can not be found ont he server as pasted below.

 

Not Found

The requested URL /members/includes/api.php was not found on this server.

 

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

 

 

--------------------------------------------------------------------------------

 

Apache/2 Server at http://www.darkknighthosting.com Port 443

 

THIS is what I am not understanding. I KNOW cURL works just fine because it is used in a function just before this point to process a credit card using the exact same method. I could REALLY use some help on this one. I am way behind on this project because of this problem. Thanks in advance.

Link to comment
Share on other sites

  • 9 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated