Reputation: 984
I am trying to use Twitters API in order to retrieve a list of hashtagged results - it used to be quite easy because their was no need for authentication but now its become tricky for me...
I have followed this post https://stackoverflow.com/questions/12916539/simplest-php-example-for-retrieving-user-timeline-with-twitter-api-version-1-1/15314662#=
But when i load my page it just displays NULL - i am sure i have done every thing correct
Notice - The PHP file below is in the same directory as the file TwitterAPIExchange
Help would be appreciated thanx
<?php
ini_set('display_errors', 1);
require_once('TwitterAPIExchange.php');
/** Set access tokens here - see: https://dev.twitter.com/apps/ **/
$settings = array(
'oauth_access_token' => "xxxxx",
'oauth_access_token_secret' => "xxxxx",
'consumer_key' => "xxxxx",
'consumer_secret' => "xxxxx"
);
$url = 'https://api.twitter.com/1.1/statuses/user_timeline.json';
$getfield = '?screen_name=j7mbo';
$requestMethod = 'GET';
$twitter = new TwitterAPIExchange($settings);
$response = $twitter->setGetfield($getfield)
->buildOauth($url, $requestMethod)
->performRequest();
var_dump(json_decode($response));
?>
Upvotes: 3
Views: 3178
Reputation: 104
Add CURLOPT_SSL_VERIFYPEER => false to the CURL options within the performRequest() method in TwitterAPIExchange.php. That seems to solve it.
cf here
Upvotes: 8
Reputation: 1007
It works fine for me. My results are here: http://pastebin.com/FB1zpuuT
Start by verifying that you can connect to this in your web browser. https://api.twitter.com/1.1/statuses/user_timeline.json
If you can connect to that, you will see an error message. If not, the problem is likely your network blocking Twitter, or Twitter blocking your ip address.
Upvotes: 2