PHP code example of checkmobi / checkmobi-php

1. Go to this page and download the library: Download checkmobi/checkmobi-php 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/ */

    

checkmobi / checkmobi-php example snippets


use checkmobi\CheckMobiRest;
$client = new CheckMobiRest("secret key here");

$client = new CheckMobiRest("secret key here", [
    "net.timeout" => 10, 
    "net.ssl_verify_peer" => false
]);


// get list of countries & flags

$response = $client->GetCountriesList();

// get account details

$response = $client->GetAccountDetails();

// get prefixes

$response = $client->GetPrefixes();

// checking a number for being valid

$response = $client->CheckNumber(array("number" => "+number_here"));

// validate a number using "Missed call method". (type can be : sms, ivr, reverse_cli)

$response = $client->RequestValidation(array("type" => "reverse_cli", "number" => "+number_here"));

// verify a pin for a certain request

$response = $client->VerifyPin(array("id" => "request id here", "pin" => "5659"));

// check validation status for a certain request

$response = $client->ValidationStatus(array("id" => "request id here"));

// get remote config profile

$response = $client->GetRemoteConfigProfile(array("number" => "+number_here", "platform" => "android"));

// send a custom sms

$response = $client->SendSMS(array("to" => "+number_here", "text" => "message here"));

// get sms details

$response = $client->GetSmsDetails(array("id" => "sms id here"));

// place call

$params = [
    "from" => "+source_number_here", 
    "to" => "+destination_number_here", 
    "events" => [
        ["action" => "speak", "text" => "Hello world", "loop" => 2, "language" => "en-US"]
    ]
];
$response = $client->PlaceCall($params);

// get call details

$response = $client->GetCallDetails(array("id" => "call id here"));

// hangup call

$response = $client->HangUpCall(array("id" => "call id here"));

// perform HLR Lookup

$response = $client->HLRLookup(["number"=> "+number here"]);

// perform MNP Lookup

$response = $client->MNPLookup(["number"=> "+number here"]);

// perform number verification

$response = $client->VerifyLookup(["number"=> "+number here"]);



if($response->is_success()) {
    // success 
    print_r($response->payload());
}
else
{
    // failure
    print "error code: ".$response->payload()["code"]." error message: ".$response->payload()["error"];
}

php-curl
php-openssl