Closed matt-bernhardt closed 11 years ago
Looks like you want to be checking out search/tweets.
So the $url
will be https://api.twitter.com/1.1/search/tweets.json
;
You'll be using the query (q)
search, and you can read more about this here.
Here's example code to get my username's details via the query:
$url = 'https://api.twitter.com/1.1/search/tweets.json';
$requestMethod = 'GET';
$getfield = '?q=from:j7mbo&count=1';
$twitter = new TwitterAPIExchange($settings);
$json = $twitter->setGetfield($getfield)
->buildOauth($url, $requestMethod)
->performRequest();
$result = json_decode($json);
var_dump($result);
I'm trying to use this library to replace a feature on a friend's website to present their latest tweet. I've created an application with Twitter, generated the right keys, and used your template files that have been modified via the 1.1 API documentation.
However, even though I specify my friend's twitter username, I get my tweets back from the API. Is this because I registered the application? (i.e. do I need to have my friend set up his own application) Or am I using the API wrong? I'm building the call as follows:
$url = 'https://api.twitter.com/1.1/statuses/user_timeline.json'; $getfield = '?username=FRIEND_USERNAME&count=1&exclude_replies=true'; $requestMethod = 'GET'; $latest = $twitter->setGetfield($getfield) ->buildOauth($url, $requestMethod) ->performRequest();