// The sale amount. You get this value from your payment gateway or the shopping cart $sale_amt = 50; // The Post URL (Get this value from the settings menu of this plugin) $postURL = "http://www.example.com/wp-content/plugins/wp-affiliate-platform/api/post.php"; // The Secret key (Get this value from the settings menu of this plugin) $secretKey = "4bc67180656782.45045137"; // Retrieve the value from the browser's cookie to find out who the referrer was $affiliate_id = $_COOKIE['ap_id']; // Prepare the data $data = array (); $data['secret'] = $secretKey; $data['ap_id'] = $affiliate_id; $data['sale_amt'] = $sale_amt; // send data to post URL to award the commission $ch = curl_init ($postURL); curl_setopt ($ch, CURLOPT_POST, true); curl_setopt ($ch, CURLOPT_POSTFIELDS, $data); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); $returnValue = curl_exec ($ch); curl_close($ch);