gknight Posted June 17, 2010 Share Posted June 17, 2010 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. 0 Quote Link to comment Share on other sites More sharing options...
gknight Posted June 18, 2010 Author Share Posted June 18, 2010 I am actually getting a 404 for the api.php but if I type the url path in the browser it showes up with the expected ip error. So why can't the php script find it when calling it through curl? 0 Quote Link to comment Share on other sites More sharing options...
gknight Posted June 19, 2010 Author Share Posted June 19, 2010 Any help, PLEASE?................. 0 Quote Link to comment Share on other sites More sharing options...
gknight Posted June 21, 2010 Author Share Posted June 21, 2010 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 FoundThe 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. 0 Quote Link to comment Share on other sites More sharing options...
gknight Posted June 21, 2010 Author Share Posted June 21, 2010 Oh yeah, I forgot to add in there, right after the line "$data = curl_exec($ch);", I added "echo $data;" to see what it was doing and that is how I get see the 404 error. 0 Quote Link to comment Share on other sites More sharing options...
gknight Posted June 22, 2010 Author Share Posted June 22, 2010 ok kill this thread. It is some kind of security thing that I can't find that made the api inaccessible through the main domain. had to use a work around. 0 Quote Link to comment Share on other sites More sharing options...
wiz Posted March 26, 2011 Share Posted March 26, 2011 how you fix it ? last March 23 my custom api functions stop working and the curl return nothing like yours. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.