Skip to content

Instantly share code, notes, and snippets.

@tgaraptor
Last active February 7, 2017 14:13
Show Gist options
  • Save tgaraptor/817ed02ec6774657d75d36aac954b09a to your computer and use it in GitHub Desktop.
Save tgaraptor/817ed02ec6774657d75d36aac954b09a to your computer and use it in GitHub Desktop.
php server request to the Raptor API
<?php
$moduleName =$_GET['moduleName'];
$numberOfRecommendations =$_GET['numberOfRecommendations'];
$apiKey ="[Your API Key Here]"; //API key can be found in the controlpanel
$customerId = "[Your Customer Id Here]"; //customerid can be found in the controlpanel
$raptorUrl ="http://api.raptorsmartadvisor.com/v1/". $customerId ."/" . $moduleName ."/". $numberOfRecommendations ."/" . $apiKey;
$timeOutInSeconds= 1.5;
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept:application/json',));
curl_setopt($ch, CURLOPT_URL, $raptorUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_TIMEOUT,$timeOutInSeconds);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment