<?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";
?>