Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $url = "http://wehost4you.dk/includes/api.php"; # URL to WHMCS API file
- $username = "username"; # Admin username goes here
- $password = "password"; # Admin password goes here
- $postfields["username"] = $username;
- $postfields["password"] = md5($password);
- $postfields["action"] = "addinvoicepayment"; #action performed by the [[API:Functions]]
- $postfields["invoiceid"] = "1";
- $postfields["transid"] = "5555";
- $postfields["gateway"] = "PayPal";
- $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);
- $info = curl_getinfo( $ch );
- curl_close($ch);
- $data = explode(";",$data);
- echo '<pre>'
- . print_r( $data, 1 )
- . print_r( $info, 1 );
- 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"];
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement