PHP code example of vmgltd / hlr-lookup-api-php-sdk

1. Go to this page and download the library: Download vmgltd/hlr-lookup-api-php-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

vmgltd / hlr-lookup-api-php-sdk example snippets




$client = new HlrLookupClient(
    'YOUR-API-KEY',
    'YOUR-API-SECRET',
    '/var/log/hlr-lookups.log' // an optional log file location
);

$response = $client->get('/auth-test');

if ($response->httpStatusCode == 200) {   
    // authentication was successful
}

$response = $client->post('/hlr-lookup', array(
    'msisdn' => '+905536939460'
));

// capture the HTTP status code and response body
$status_code = $response->httpStatusCode;
$data = $response->responseBody;

$response = $client->post('/nt-lookup', array(
    'number' => '+4989702626'
));

// capture the HTTP status code and response body
$status_code = $response->httpStatusCode;
$data = $response->responseBody;

$response = $client->post('/mnp-lookup', array(
    'msisdn' => '+14156226819'
));

// capture the HTTP status code and response body
$status_code = $response->httpStatusCode;
$data = $response->responseBody;