PHP

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php

function lookup($service, $msisdn){
   // Set your Spirius account username and password here
   $username = "Username";
   $password = "Password";
   $context = stream_context_create(array(
     "http" => array(
       "method" => "GET",
       "header" => "Authorization: Basic ".
                    base64_encode($username.':'.$password). "\r\n".
                    "Accept: application/json\r\n".
                    "Connection: close\r\n",
       "protocol_version" => 1.1,
       "timeout" => 60   )));
   $response = file_get_contents(
     "https://get1-spirilookup.spiricom.spirius.com:54011/v1/lookup/$service/$msisdn",
        false, $context );   if (!strstr($http_response_header[0],"200 OK")) {
     return $http_response_header[0];
   }   return $response;
 }
echo lookup("sweden", "         ") . "\n";

?>