public function __construct($args = false)
{
// If no args were passed, use the command line args
if ($args === false) {
$args = $_SERVER['argv'];
// Drop the script name
array_shift($args);
}
// Make sure we have credentials on the command line
if (count($args) < 2) {
die('Please specify your DataSift username and API key as the first two command line arguments!' . PHP_EOL);
}
try {
$username = array_shift($args);
$api_key = array_shift($args);
$this->user = new DataSift_User($username, $api_key);
} catch (Exception $e) {
die('Failed to create the DataSift_User object - check your username and API key!' . PHP_EOL);
}
$this->args = $args;
}