Skip to content

Instantly share code, notes, and snippets.

@infusedmj
Created July 1, 2013 02:56
Show Gist options
  • Save infusedmj/5898086 to your computer and use it in GitHub Desktop.
Save infusedmj/5898086 to your computer and use it in GitHub Desktop.
<?php
// START OAP API
$data = "<purchase_history>
<contact_id>246029</contact_id>
</purchase_history>";
$data = urlencode(urlencode($data));
// Replace the strings with your API credentials located in Admin > OfficeAutoPilot API Instructions and Key Manager
$appid = "our-app-id";
$key = "our-app-key";
$reqType = "purchase_history";
$postargs = "appid=".$appid."&key=".$key."&reqType=".$reqType."&data=".$data;
$request = "https://api.moon-ray.com/pdata.php";
$session = curl_init($request);
curl_setopt ($session, CURLOPT_POST, true);
curl_setopt ($session, CURLOPT_POSTFIELDS, $postargs);
curl_setopt ($session, CURLOPT_HEADER, false);
curl_setopt ($session, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($session);
curl_close($session);
header("Content-Type: text/xml");
echo $response;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment