frenchsquared Posted April 23, 2010 Share Posted April 23, 2010 (edited) I am trying to retrieve invoice details through the API. However I cant see to get the initial api call working. I created a InvoicePaid hook that handles my affiliate tracking info. This only returns the invoice id. i want to use that id to get more customer details. $url = "http://www.myurl.com/account/includes/api.php"; # URL to WHMCS API file $username = "myusername"; # Admin username goes here $password = "mypassword"; # Admin password goes here $postfields["username"] = $username; $postfields["password"] = md5($password); $postfields["action"] = "getinvoice"; #action performed by the API:Functions $postfields["invoiceid"] = $vars['invoiceid']; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); 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); curl_close($ch); echo $data; $data = explode(";",$data); foreach ($data AS $temp) { $temp = explode("=",$temp); $results[$temp[0]] = $temp[1]; } if ($results["result"]=="success") { # Result was OK! } else { # An error occured echo "The following error occured: ".$results["message"]; the only thing I get isThe following error occured: Invalid IP 174.121.38.58 Edited April 23, 2010 by frenchsquared 0 Quote Link to comment Share on other sites More sharing options...
frenchsquared Posted April 23, 2010 Author Share Posted April 23, 2010 (edited) I fixed the ip issue by adding my ip to the general security tab. However, now nothing happens. result=error;message=Authentication Failed; Edited April 23, 2010 by frenchsquared 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted April 24, 2010 Share Posted April 24, 2010 Take a look in admin -> Setup -> Banned Ip's for your IP 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.