PHP code example of messente / messente-phonebook-php
1. Go to this page and download the library: Download messente/messente-phonebook-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/ */
messente / messente-phonebook-php example snippets
essente\Phonebook\Configuration;
use Messente\Phonebook\Api\BlacklistApi;
use GuzzleHttp\Client;
// Configure HTTP basic authorization: basicAuth
$config = Configuration::getDefaultConfiguration()
->setUsername('YOUR_MESSENTE_API_USERNAME')
->setPassword('YOUR_MESSENTE_API_PASSWORD');
$apiInstance = new BlacklistApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new Client(),
$config
);
try {
$response = $apiInstance->fetchBlacklist();
echo $response;
} catch (Exception $e) {
echo 'Exception when calling fetchBlacklist: ', $e->getMessage(), PHP_EOL;
}
// try {
// $apiInstance->addToBlacklist(['phoneNumber' => '+37255555555']);
// } catch (Exception $e) {
// echo 'Exception when calling addToBlacklist: ', $e->getMessage(), PHP_EOL;
// }
// try {
// $apiInstance->isBlacklisted('+37255555555');
// } catch (Exception $e) {
// echo 'Exception when calling isBlacklisted: ', $e->getMessage(), PHP_EOL;
// }
// try {
// $apiInstance->removeFromBlacklist('+37255555555');
// } catch (Exception $e) {
// echo 'Exception when calling removeFromBlacklist: ', $e->getMessage(), PHP_EOL;
// }