Skip to content

Instantly share code, notes, and snippets.

@raorao
Created January 7, 2014 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raorao/8306320 to your computer and use it in GitHub Desktop.
Save raorao/8306320 to your computer and use it in GitHub Desktop.
<?php
function slowApiLookup() {
try {
$url = "http://slowapi.com/delay/5.0";
$curlSession = curl_init();
curl_setopt($curlSession, CURLOPT_URL, $url);
curl_setopt($curlSession, CURLOPT_RETURNTRANSFER,1);
curl_setopt($curlSession, CURLOPT_TIMEOUT,1);
$response = curl_exec($curlSession);
}
catch (Exception $e) {
echo false;
};
return $response;
// uncomment for mocking successful API requests
// return array("some property" => $response);
};
require_once(__DIR__.'/km.php');
$KM_KEY = 'some hex';
KM::init("$KM_KEY");
KM::identify('bob@bob.com');
KM::record('Purchased', array(
'Product ID' => 'some id',
'Product Name' => 'some name',
'Price' => 'some price'
));
$rapleaf = slowApiLookup();
KM::set($rapleaf);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment