diff -r 15a1a28f609a -r 8b3d57a519eb web/search_tweets.php --- a/web/search_tweets.php Fri Jun 15 08:40:12 2018 +0000 +++ b/web/search_tweets.php Mon Jun 18 23:15:34 2018 +0200 @@ -7,11 +7,8 @@ } -/** - * include some common code (like we did in the 90s) - * People still do this? ;) - */ include_once 'common.php'; +use Abraham\TwitterOAuth\TwitterOAuth; /** * Check for a POSTed status message to send to Twitter @@ -24,21 +21,25 @@ * signs and encodes all our requests without additional work */ - if (isset($_GET['endpoint'])) { - $endpoint = $_GET['endpoint']; - unset($_GET['endpoint']); - } else { - $endpoint = "search/tweets"; - } + // if (isset($_GET['endpoint'])) { + // $endpoint = $_GET['endpoint']; + // unset($_GET['endpoint']); + // } else { + // $endpoint = "search/tweets"; + // } $token = unserialize($_SESSION['TWITTER_ACCESS_TOKEN']); - $client = $token->getHttpClient($configuration); - $client->setUri("https://api.twitter.com/1.1/$endpoint.json"); - $client->setMethod(Zend_Http_Client::GET); - $client->setParameterGet($_GET); - $response = $client->request(); + $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $token['oauth_token'], $token['oauth_token_secret']); - echo $response->getBody(); + $statuses = $connection->get("search/tweets", $_GET); + // $client = $token->getHttpClient($configuration); + // $client->setUri("https://api.twitter.com/1.1/$endpoint.json"); + // $client->setMethod(Zend_Http_Client::GET); + // $client->setParameterGet($_GET); + // $response = $client->request(); + + // echo $response->getBody(); + echo json_encode($statuses); } else { /**