500 Internal Server Error


Im trying to use the search function buy I’m getting an Internal Server Error
Any idea?

This is my code:

$url = 'https://api.twitter.com/1.1/search/tweets.json';
$getfield = '?'.$_SERVER['QUERY_STRING'];
$requestMethod = 'GET';
$twitter = new TwitterAPIExchange($settings);

$api_response = $twitter ->setGetfield($getfield)
                     ->buildOauth($url, $requestMethod)


Hint: Indent code by 4 spaces, so it displays properly.

It looks like you are not encoding the get parameters correctly. I am pretty sure there is no reserved variable called $SERVER in PHP. If you meant $_SERVER, this has no QUERYSTRING, but a QUERY_STRING item.
Still you should probably better do something like the following:

$url           = "https://api.twitter.com/1.1/search/tweets.json";
$getfield      = "?q=" . urlencode($_GET['q']);

$twitter = new TwitterAPIExchange($settings);
echo $twitter->setGetfield($getfield)
             ->buildOauth($url, 'GET')


Thanks ePirat!

Finally, It was just an issue with the Hosting.
They made some changes in the Apache mod_security rules and now its working