public function testExecuteQueryWithInvalidAPIKey()
 {
     \VCR\VCR::turnOn();
     \VCR\VCR::insertCassette('search_without_valid_api_key');
     $temp_key = getenv('TWINGLY_SEARCH_KEY');
     putenv('TWINGLY_SEARCH_KEY=wrong');
     $c = new Client();
     try {
         $q = $c->query();
         $q->pattern = 'something';
         $c->execute_query($q);
         $this->fail('Should throw AuthException.');
     } catch (AuthException $e) {
         $this->assertEquals('The API key does not exist.', $e->getMessage());
         putenv('TWINGLY_SEARCH_KEY=' . $temp_key);
     }
     \VCR\VCR::turnOff();
 }
<?php

require 'vendor/autoload.php';
use Twingly\Client;
$client = new Client();
$query = $client->query();
$query->pattern = '"hello world"';
$query->start_time = (new \DateTime('now', new \DateTimeZone('UTC')))->sub(new \DateInterval('P1D'));
$results = $query->execute();
foreach ($results->posts as $post) {
    echo $post->url . "\n";
}