Skip to content

Instantly share code, notes, and snippets.

@tgaraptor
tgaraptor / raptorrequest_callraptor.php
Last active February 7, 2017 14:13
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;
@tgaraptor
tgaraptor / raptorrequest_index.php
Created February 7, 2017 13:43
Non-blocking async raptor request using ajax and php
<html>
<head>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
</head>
<body>
<div id="output"></div>
<script type="text/javascript">
@tgaraptor
tgaraptor / raptorrequest_csharp.cs
Last active February 7, 2017 13:30
Async, non-blocking request to the Raptor API with timeout and fallback
using System;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
namespace RaptorCaller
{