Skip to content

Instantly share code, notes, and snippets.

@Bogdaan
Last active February 21, 2017 19:31
Show Gist options
  • Select an option

  • Save Bogdaan/72f4bb292e4a2f79e2f0d4ca582dd4b1 to your computer and use it in GitHub Desktop.

Select an option

Save Bogdaan/72f4bb292e4a2f79e2f0d4ca582dd4b1 to your computer and use it in GitHub Desktop.
Get account info for viber IM
<?php
/**
* Before you run this example:
* 1. copy config.php.dist to config.php: cp config.php.dist config.php
*
* @author Novikov Bogdan <hcbogdan@gmail.com>
*/
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
require_once("../vendor/autoload.php");
use Viber\Client;
$apiKey = $config['apiKey']; // from PA "Edit Details" page
try {
$client = new Client([ 'token' => $apiKey ]);
$result = $client->getAccountInfo();
print_r($result);
} catch (Exception $e) {
echo "Error: ". $e->getError() ."\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment