<?php

require_once('TwitterAPIExchange.php');

$settings = array(
    'oauth_access_token' => "5407042-SH6T93eVKdxOIs7fyVrf745i0qwJz7DiBhJve3qqUd",
    'oauth_access_token_secret' => "dyt2qVG6hLUEL0cqI9Ki6fqsK8g4Hm2lJ5zffbHzy9jBp",
    'consumer_key' => "UKAQrooAohpAVItz30yC83xtl",
    'consumer_secret' => "ihMCey5gS80DbvTXvkkDCiO9YYWDPqLcM9ArMF0Pem8jwC2sNc"
);

$url = 'https://api.twitter.com/1.1/search/tweets.json';

$query = $_GET['q'];
$count = 5;
$result_type = 'recent';

$params = '?';
$params .= 'q='.urlencode($query);
$params .= '&count='.$count;
$params .= '&result_type='.$result_type;

//echo json_encode($params);

// $params = "?q=@andoru&count=5";

$requestMethod = 'GET';

$twitter = new TwitterAPIExchange($settings);
$response =  $twitter->setGetfield($params)
             		->buildOauth($url, $requestMethod)
             		->performRequest();

echo $response

?>