Twitter::search PHP Method

    public function search($query, $full = FALSE)
    {
        $res = $this->request('search/tweets', 'GET', is_array($query) ? $query : ['q' => $query]);
        return $full ? $res : $res->statuses;
    }

Usage Example

コード例 #1
0
ファイル: some_examples.php プロジェクト: 0x27/mrw-code
<?php

require '../common/globals.php';
require '../common/twitter-php-3.2/src/twitter.class.php';
// Fill in the next 2 variables.
$access_token = '15201275-loypZtq58TRB1qoIIu6fTw6TSEqluGZ1aMKgVJjJe';
$access_token_secret = 'haKjTuzH9N6UPhOBZDKSsu6FAZzIvLNbwGhi5wfy00Y';
$twitter = new Twitter(OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET, $access_token, $access_token_secret);
try {
    $results = $twitter->search('#ibm');
    foreach ($results as $result) {
        echo "message: ", $result->text;
        echo "posted at ", $result->created_at;
        echo "posted by ", $result->form_user;
    }
    echo "\n\n\n\n";
} catch (TwitterException $e) {
    echo "Error searching Twitter: ", $e->getMessage();
}
try {
    $statuses = $twitter->request('statuses/retweets_of_me', 'GET', array('count' => 20));
    foreach ($statuses as $status) {
        echo "message: ", $status->text;
        echo "posted at ", $status->created_at;
        echo "posted by ", $status->form_user;
    }
    echo "\n\n\n\n";
} catch (TwitterException $e) {
    echo "Error getting statuses from Twitter: ", $e->getMessage();
}
try {
All Usage Examples Of Twitter::search