Giter VIP home page Giter VIP logo

twitter's Introduction

Twitter for PHP

Software License StyleCI Latest Version on Packagist 3.x Downloads 2.x Downloads GitHub Release Date

Twitter API for Laravel 10.x, 11.x (and new versions as they are released). Also supports other frameworks via PHP-DI (or feel free to add support for your framework via PR)

You need to create an application and create your access token in the Application Management.

Installation

composer require atymic/twitter:^3.0 -W

Laravel Configuration

Just set the below environment variables in your .env.

TWITTER_CONSUMER_KEY=
TWITTER_CONSUMER_SECRET=
TWITTER_ACCESS_TOKEN=
TWITTER_ACCESS_TOKEN_SECRET=
TWITTER_API_VERSION=

Advanced Laravel configuration

Run php artisan vendor:publish --provider="Atymic\Twitter\ServiceProvider\LaravelServiceProvider"

/config/twitter.php

Versions

3.x

3.x is the current major version, and is not backward compatible with 2.x.

See the migration guide in UPGRADE.md.

2.x

2.x is not longer maintained. We are not accepting bug fixes, please upgrade to 3.x

Usage

Output format

You can choose between three different output formats. By default, API v1 responses will be returned as objects while API v2 responses will be returned as JSON. To change this, use the response_format option in the parameters you pass to any method.

response_format : object|json|array (v1 default:object) (v2 default:json)

Twitter API Versions

To set the default twitter API version to v2 instead of the default v1.1, set the TWITTER_API_VERSION to 2 in your .env.

If you have set the v1.1 api as the default, you can use use Twitter::forApiV2() to get an instance of the v2 client. The same goes for getting a v1 instance from a v2 client, using Twitter::forApiV1().

It is safe to call Twitter::forApiV1() on either a v1 or v2 client instance.

Functions

Twitter API v1.1

Account

  • getSettings() - Returns settings (including current trend, geo and sleep time information) for the authenticating user.
  • getCredentials()
  • postSettings() - Updates the authenticating user’s settings.
  • postSettingsDevice() - Sets which device Twitter delivers updates to for the authenticating user. Sending none as the device parameter will disable SMS updates.
  • postProfile() - Sets some values that users are able to set under the “Account” tab of their settings page. Only the parameters specified will be updated.
  • postBackground() - Updates the authenticating user’s profile background image. This method can also be used to enable or disable the profile background image.
  • postProfileImage() - Updates the authenticating user’s profile image. Note that this method expects raw multipart data, not a URL to an image.
  • destroyUserBanner() - Removes the uploaded profile banner for the authenticating user. Returns HTTP 200 upon success.
  • postUserBanner() - Uploads a profile banner on behalf of the authenticating user. For best results, upload an profile_banner_url node in their Users objects.

Account Activity (Premium)

  • setWebhook($env, $url) - Registers a webhook url for all event types in the given environment.
  • crcHash($crcToken) - Returns HMAC SHA-256 hash from the given CRC token and consumer secret. You'll need to return this on your webhook (more info).
  • getWebhooks($env) - Returns webhook URLs for the given environment (or all environments if none provided), and their statuses for the authenticating app.
  • updateWebhooks($env, $webhookId) - Triggers the challenge response check (CRC) for the given enviroments webhook for all activites. If the check is successful, returns true and reenables the webhook by setting its status to valid.
  • destroyWebhook($env, $webhookId) - Removes the webhook from the provided application's all activities configuration. Returns true on success.
  • setSubscriptions($env) - Subscribes the provided application to all events for the provided environment for all message types. Returns true on success.
  • getSubscriptions($env) - Returns true if the provided user context has an active subscription with provided application.
  • getSubscriptionsCount() - Returns the count of subscriptions that are currently active on your account for all activities.
  • getSubscriptionsList($env) - Returns a list of the current All Activity type subscriptions.
  • destroyUserSubscriptions($env, $userId) - Deactivates subscription for the specified user id from the environment. Returns true on success.

Block

  • getBlocks() - Returns a collection of user objects that the authenticating user is blocking.
  • getBlocksIds() - Returns an array of numeric user ids the authenticating user is blocking.
  • postBlock() - Blocks the specified user from following the authenticating user. In addition the blocked user will not show in the authenticating users mentions or timeline (unless retweeted by another user). If a follow or friend relationship exists it is destroyed.
  • destroyBlock() - Un-blocks the user specified in the ID parameter for the authenticating user. Returns the un-blocked user in the requested format when successful. If relationships existed before the block was instated, they will not be restored.

DirectMessage

  • getDm() - Returns a single direct message event, specified by an id parameter.
  • getDms() - Returns all Direct Message events (both sent and received) within the last 30 days. Sorted in reverse-chronological order.
  • destroyDm() - Destroys the direct message specified in the required ID parameter. The authenticating user must be the recipient of the specified direct message.
  • postDm() - Publishes a new message_create event resulting in a Direct Message sent to a specified user from the authenticating user. Returns an event if successful. Supports publishing Direct Messages with optional Quick Reply and media attachment.

Favorite

  • getFavorites() - Returns the 20 most recent Tweets favorited by the authenticating or specified user.
  • destroyFavorite() - Un-favorites the status specified in the ID parameter as the authenticating user. Returns the un-favorited status in the requested format when successful.
  • postFavorite() - Favorites the status specified in the ID parameter as the authenticating user. Returns the favorite status when successful.

Friendship

  • getNoRters() - Returns a collection of user_ids that the currently authenticated user does not want to receive retweets from.
  • getFriendsIds() - Returns a cursored collection of user IDs for every user following the specified user.
  • getFollowersIds() - Returns a cursored collection of user IDs for every user following the specified user.
  • getFriendshipsIn() - Returns a collection of numeric IDs for every user who has a pending request to follow the authenticating user.
  • getFriendshipsOut() - Returns a collection of numeric IDs for every protected user for whom the authenticating user has a pending follow request.
  • postFollow() - Allows the authenticating users to follow the user specified in the ID parameter.
  • postUnfollow() - Allows the authenticating user to unfollow the user specified in the ID parameter.
  • postFollowUpdate() - Allows one to enable or disable retweets and device notifications from the specified user.
  • getFriendships() - Returns detailed information about the relationship between two arbitrary users.
  • getFriends() - Returns a cursored collection of user objects for every user the specified user is following ( otherwise known as their “friends”).
  • getFollowers() - Returns a cursored collection of user objects for users following the specified user.
  • getFriendshipsLookup() - Returns the relationships of the authenticating user to the comma-separated list of up to 100 screen_names or user_ids provided. Values for connections can be: following, following_requested, followed_by, none, blocking, muting.

Geo

  • getGeo() - Returns all the information about a known place.
  • getGeoReverse() - Given a latitude and a longitude, searches for up to 20 places that can be used as a place_id when updating a status.
  • getGeoSearch() - Search for places that can be attached to a statuses/update. Given a latitude and a longitude pair, an IP address, or a name, this request will return a list of all the valid places that can be used as the place_id when updating a status.
  • getGeoSimilar() - Locates places near the given coordinates which are similar in name. Conceptually you would use this method to get a list of known places to choose from first. Then, if the desired place doesn't exist, make a request to POST geo/place to create a new one. The token contained in the response is the token needed to be able to create a new place.

Help

  • postSpam() - Report the specified user as a spam account to Twitter. Additionally performs the equivalent of POST blocks / create on behalf of the authenticated user.
  • getHelpConfiguration() - Returns the current configuration used by Twitter including twitter.com slugs which are not usernames, maximum photo resolutions, and t.co URL lengths.
  • getHelpLanguages() - Returns the list of languages supported by Twitter along with the language code supported by Twitter.
  • getHelpPrivacy() - Returns Twitter’s Privacy Policy.
  • getHelpTos() - Returns the Twitter Terms of Service. Note: these are not the same as the Developer Policy.
  • getAppRateLimit() - Returns the current rate limits for methods belonging to the specified resource families.

List

  • getLists() - Returns all lists the authenticating or specified user subscribes to, including their own. The user is specified using the user_id or screen_name parameters. If no user is given, the authenticating user is used.
  • getListStatuses() - Returns a timeline of tweets authored by members of the specified list. Retweets are included by default. Use the include_rts=false parameter to omit retweets.
  • destroyListMember() - Removes the specified member from the list. The authenticated user must be the list’s owner to remove members from the list.
  • getListsMemberships() - Returns the lists the specified user has been added to. If user_id or screen_name are not provided the memberships for the authenticating user are returned.
  • getListsSubscribers() - Returns the subscribers of the specified list. Private list subscribers will only be shown if the authenticated user owns the specified list.
  • postListSubscriber() - Subscribes the authenticated user to the specified list.
  • getListSubscriber() - Returns the subscribers of the specified list. Private list subscribers will only be shown if the authenticated user owns the specified list.
  • destroyListSubscriber() - Unsubscribes the authenticated user from the specified list.
  • postListCreateAll() - Adds multiple members to a list, by specifying a comma-separated list of member ids or screen names. The authenticated user must own the list to be able to add members to it. Note that lists can’t have more than 5,000 members, and you are limited to adding up to 100 members to a list at a time with this method.
  • getListMember() - Check if the specified user is a member of the specified list.
  • getListMembers() - Returns the members of the specified list. Private list members will only be shown if the authenticated user owns the specified list.
  • postListMember() - Add a member to a list. The authenticated user must own the list to be able to add members to it. Note that lists cannot have more than 5,000 members.
  • destroyList() - Deletes the specified list. The authenticated user must own the list to be able to destroy it.
  • postListUpdate() - Updates the specified list. The authenticated user must own the list to be able to update it.
  • postList() - Creates a new list for the authenticated user. Note that you can’t create more than 20 lists per account.
  • getList() - Returns the specified list. Private lists will only be shown if the authenticated user owns the specified list.
  • getListSubscriptions() - Obtain a collection of the lists the specified user is subscribed to, 20 lists per page by default. Does not include the user’s own lists.
  • destroyListMembers() - Removes multiple members from a list, by specifying a comma-separated list of member ids or screen names. The authenticated user must own the list to be able to remove members from it. Note that lists can’t have more than 500 members, and you are limited to removing up to 100 members to a list at a time with this method.
  • getListOwnerships() - Returns the lists owned by the specified Twitter user. Private lists will only be shown if the authenticated user is also the owner of the lists.

Media

  • uploadMedia() - Upload media (images) to Twitter, to use in a Tweet or Twitter-hosted Card.

Search

  • getSearch() - Returns a collection of relevant Tweets matching a specified query.
  • getSavedSearches() - Returns the authenticated user’s saved search queries.
  • getSavedSearch() - Retrieve the information for the saved search represented by the given id. The authenticating user must be the owner of saved search ID being requested.
  • postSavedSearch() - Create a new saved search for the authenticated user. A user may only have 25 saved searches.
  • destroySavedSearch() - Destroys a saved search for the authenticating user. The authenticating user must be the owner of saved search id being destroyed.

Status

  • getMentionsTimeline() - Returns the 20 most recent mentions (tweets containing a users’s @screen_name) for the authenticating user.
  • getUserTimeline() - Returns a collection of the most recent Tweets posted by the user indicated by the screen_name or user_id parameters.
  • getHomeTimeline() - Returns a collection of the most recent Tweets and retweets posted by the authenticating user and the users they follow. The home timeline is central to how most users interact with the Twitter service. *
  • getRtsTimeline() - Returns the most recent tweets authored by the authenticating user that have been retweeted by others.
  • getRts() - Returns a collection of the 100 most recent retweets of the tweet specified by the id parameter.
  • getTweet() - Returns a single Tweet, specified by the id parameter. The Tweet’s author will also be embedded within the tweet.
  • destroyTweet() - Destroys the status specified by the required ID parameter. The authenticating user must be the author of the specified status. Returns the destroyed status if successful.
  • postTweet() - Updates the authenticating user’s current status, also known as tweeting.
  • postRt() - Retweets a tweet. Returns the original tweet with retweet details embedded.
  • getOembed() - Returns a single Tweet, specified by either a Tweet web URL or the Tweet ID, in an oEmbed-compatible format. The returned HTML snippet will be automatically recognized as an Embedded Tweet when Twitter’s widget JavaScript is included on the page.
  • getRters() - Returns a collection of up to 100 user IDs belonging to users who have retweeted the tweet specified by the id parameter.
  • getStatusesLookup() - Returns fully-hydrated tweet objects for up to 100 tweets per request, as specified by comma-separated values passed to the id parameter.

Trend

  • getTrendsPlace() - Returns the top 10 trending topics for a specific WOEID, if trending information is available for it.
  • getTrendsAvailable() - Returns the locations that Twitter has trending topic information for.
  • getTrendsClosest() - Returns the locations that Twitter has trending topic information for, closest to a specified location.

User

  • getUsersLookup() - Returns fully-hydrated user objects for up to 100 users per request, as specified by comma-separated values passed to the user_id and/or screen_name parameters.
  • getUsers() - Returns a variety of information about the user specified by the required user_id or screen_name parameter. The author’s most recent Tweet will be returned inline when possible.
  • getUsersSearch() - Provides a simple, relevance-based search interface to public user accounts on Twitter. Try querying by topical interest, full name, company name, location, or other criteria. Exact match searches are not supported.
  • getUserBanner() - Returns a map of the available size variations of the specified user’s profile banner. If the user has not uploaded a profile banner, a HTTP 404 will be served instead. This method can be used instead of string manipulation on the profile_banner_url returned in user objects as described in Profile Images and Banners.
  • muteUser() - Mutes the user specified in the ID parameter for the authenticating user.
  • unmuteUser() - Un-mutes the user specified in the ID parameter for the authenticating user.
  • mutedUserIds() - Returns an array of numeric user ids the authenticating user has muted.
  • mutedUsers() - Returns an array of user objects the authenticating user has muted.
  • getSuggesteds() - Access the users in a given category of the Twitter suggested user list.
  • getSuggestions() - Access to Twitter’s suggested user list. This returns the list of suggested user categories. The category can be used in GET users / suggestions / :slug to get the users in that category.
  • getSuggestedsMembers() - Access the users in a given category of the Twitter suggested user list and return their most recent status if they are not a protected user.

Twitter API v2

Tweet Lookup

  • getTweet() - Returns a variety of information about a single Tweet specified by the requested ID.
  • getTweets() - Returns a variety of information about the Tweet specified by the requested ID or list of IDs.

Search Tweets

  • searchRecent() - The recent search endpoint returns Tweets from the last seven days that match a search query.

  • searchAll() - The full-archive search endpoint returns the complete history of public Tweets matching a search query; since the first Tweet was created March 26, 2006.

    Note: This endpoint is only available to those approved for the Academic Research product track.

Timelines

  • userTweets() - Returns Tweets composed by a single user, specified by the requested user ID. By default, the most recent ten Tweets are returned per request. Using pagination, the most recent 3,200 Tweets can be retrieved.
  • userMentions() - Returns Tweets mentioning a single user specified by the requested user ID. By default, the most recent ten Tweets are returned per request. Using pagination, up to the most recent 800 Tweets can be retrieved.

Filtered Stream

  • getStreamRules() - Return a list of rules currently active on the streaming endpoint, either as a list or individually.
  • postStreamRules() - Add or delete rules to your stream.
  • getStream() - Streams Tweets in real-time based on a specific set of filter rules.

Sampled Stream

  • getSampledStream() - Streams about 1% of all Tweets in real-time.

Hide Replies

  • hideTweet() - Hides or unhides a reply to a Tweet.

Tweet Counts

  • countRecent() - Receive a count of Tweets that match a query in the last 7 days

  • countAll() - Receive a count of Tweets that match a query

    Note: Only available via the Academic Research product track.

Helper Functions

Linkify : Transforms URLs, @usernames, hashtags into links. The type of $tweet can be object, array or text. By sending an object or an array the method will expand links (t.co) too.

Twitter::linkify($tweet);

Ago : Converts date into difference (2 hours ago)

Twitter::ago($timestamp);

LinkUser : Generates a link to a specific user, by their user object (such as $tweet->user), or id/string.

Twitter::linkUser($user);

LinkTweet : Generates a link to a specific tweet.

Twitter::linkTweet($tweet);

Examples

Returns a collection of the most recent Tweets posted by the user indicated by the screen_name or user_id parameters.

Route::get('/userTimeline', function()
{
	return Twitter::getUserTimeline(['screen_name' => 'thujohn', 'count' => 20, 'response_format' => 'json']);
});

Returns a collection of the most recent Tweets and retweets posted by the authenticating user and the users they follow.

Route::get('/homeTimeline', function()
{
	return Twitter::getHomeTimeline(['count' => 20, 'response_format' => 'json']);
});

Returns the X most recent mentions (tweets containing a users's @screen_name) for the authenticating user.

Route::get('/mentionsTimeline', function()
{
	return Twitter::getMentionsTimeline(['count' => 20, 'response_format' => 'json']);
});

Updates the authenticating user's current status, also known as tweeting.

Route::get('/tweet', function()
{
	return Twitter::postTweet(['status' => 'Laravel is beautiful', 'response_format' => 'json']);
});

Updates the authenticating user's current status with media.

Route::get('/tweetMedia', function()
{
	$uploaded_media = Twitter::uploadMedia(['media' => File::get(public_path('filename.jpg'))]);
	return Twitter::postTweet(['status' => 'Laravel is beautiful', 'media_ids' => $uploaded_media->media_id_string]);
});

Get User Credentials with email.

$credentials = Twitter::getCredentials([
    'include_email' => 'true',
]);

In the above, you need to pass true as a string, not as a boolean. The boolean will get converted to 1 which Twitter ignores.

This also is assuming you have your permissions setup correctly with Twitter. You have to choose 'Get user email' when you set up your Twitter app, passing the value alone will not be enough.

Sign in with twitter

use Atymic\Twitter\Facade\Twitter;

Route::get('twitter/login', ['as' => 'twitter.login', static function () {
    $token = Twitter::getRequestToken(route('twitter.callback'));

    if (isset($token['oauth_token_secret'])) {
        $url = Twitter::getAuthenticateUrl($token['oauth_token']);

        Session::put('oauth_state', 'start');
        Session::put('oauth_request_token', $token['oauth_token']);
        Session::put('oauth_request_token_secret', $token['oauth_token_secret']);

        return Redirect::to($url);
    }

    return Redirect::route('twitter.error');
}]);

Route::get('twitter/callback', ['as' => 'twitter.callback', static function () {
    // You should set this route on your Twitter Application settings as the callback
    // https://apps.twitter.com/app/YOUR-APP-ID/settings
    if (Session::has('oauth_request_token')) {
        $twitter = Twitter::usingCredentials(session('oauth_request_token'), session('oauth_request_token_secret'));
        $token = $twitter->getAccessToken(request('oauth_verifier'));

        if (!isset($token['oauth_token_secret'])) {
            return Redirect::route('twitter.error')->with('flash_error', 'We could not log you in on Twitter.');
        }

        // use new tokens
        $twitter = Twitter::usingCredentials($token['oauth_token'], $token['oauth_token_secret']);
        $credentials = $twitter->getCredentials();

        if (is_object($credentials) && !isset($credentials->error)) {
            // $credentials contains the Twitter user object with all the info about the user.
            // Add here your own user logic, store profiles, create new users on your tables...you name it!
            // Typically you'll want to store at least, user id, name and access tokens
            // if you want to be able to call the API on behalf of your users.

            // This is also the moment to log in your users if you're using Laravel's Auth class
            // Auth::login($user) should do the trick.

            Session::put('access_token', $token);

            return Redirect::to('/')->with('notice', 'Congrats! You\'ve successfully signed in!');
        }
    }

    return Redirect::route('twitter.error')
            ->with('error', 'Crab! Something went wrong while signing you up!');
}]);

Route::get('twitter/error', ['as' => 'twitter.error', function () {
    // Something went wrong, add your own error handling here
}]);

Route::get('twitter/logout', ['as' => 'twitter.logout', function () {
    Session::forget('access_token');

    return Redirect::to('/')->with('notice', 'You\'ve successfully logged out!');
}]);

Webhook

In order to setup webhook successfully, you'll need to return a hash using the CRC token in response from your webhook URL (more info).

Route::post('twitter/webhook', ['as' => 'twitter.webhook', function(){
	if (request()->has('crc_token'))
		return response()->json(['response_token' => Twitter::crcHash(request()->crc_token)], 200);
	
	// Your webhook logic goes here
}]);

Twitter API v2 Examples

Get user tweets:

// ...

use Atymic\Twitter\Twitter as TwitterContract;
use Illuminate\Http\JsonResponse;
use Twitter;

// ... 

public function userTweets(int $userId): JsonResponse
{
	$params = [
		'place.fields' => 'country,name',
		'tweet.fields' => 'author_id,geo',
		'expansions' => 'author_id,in_reply_to_user_id',
		TwitterContract::KEY_RESPONSE_FORMAT => TwitterContract::RESPONSE_FORMAT_JSON,
	];

	return JsonResponse::fromJsonString(Twitter::userTweets($userId, $params));
}

Search tweets:

// ...
public function searchRecent(string $query): JsonResponse
{
    $params = [
        'place.fields' => 'country,name',
        'tweet.fields' => 'author_id,geo',
        'expansions' => 'author_id,in_reply_to_user_id',
        TwitterContract::KEY_RESPONSE_FORMAT => TwitterContract::RESPONSE_FORMAT_JSON,
    ];

    return JsonResponse::fromJsonString(Twitter::searchRecent($query, $params));
}
// ...
Call a newly added endpoint:

Since Twitter API v2 is in active development, you might need to call an endpoint we did not explicitly document in the "Functions" section above. Here is an example of how you may use this package to make calls to any newly added endpoints. Here we use the newly added "recent count" endpoint.

// ...
$querier = \Atymic\Twitter\Facade\Twitter::forApiV2()
    ->getQuerier();
$result = $querier
    ->withOAuth2Client()
    ->get('tweets/counts/recent', ['query' => 'foo']);
// ...

Debug

First activate debug mode in the config file.

Then you can access the logs() method.

try
{
	$response = Twitter::getUserTimeline(['count' => 20, 'response_format' => 'array']);
}
catch (Exception $e)
{
	// dd(Twitter::error());
	dd(Twitter::logs());
}

dd($response);

twitter's People

Contributors

anahkiasen avatar atymic avatar clarkf avatar craytor avatar dantaylorseo avatar djug avatar ebisbe avatar ejunker avatar j3j5 avatar janpio avatar juukie avatar kamleshpaul avatar leewillis77 avatar marcorivm avatar mateusrevoredo avatar maumagau avatar mikevrind avatar mustorze avatar nhalloran avatar nivv avatar nwidart avatar pajoda avatar reliq avatar robertdeniszczyc avatar sdebruyn avatar silentfred avatar studio384 avatar thujohn avatar titantwentyone avatar trapvincenzo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

twitter's Issues

Exclude_replies breaks the counting part

When you exclude mentions, the count doesn't work anymore:

$timeline = Twitter::getUserTimeline(array('screen_name' => 'foobar', 'count' => 3, 'exclude_replies' => true));

In my case at the moment, I only have one tweet in my response, because of the excluding of replies (the last two tweets are replies).

Undefined ttwiter index

Hi, Mr. John. I got error when trying to initiate your package. It showed error like this:

ThanksForYourHelp 👍

ErrorException (E_UNKNOWN)

Undefined index: ttwitter::config
Open: /var/www/html/integration/vendor/thujohn/twitter/src/Thujohn/Twitter/Twitter.php

* Only for debugging
*/
private $debug;
private $log = [];
public function __construct($config = [], SessionStore $session)
{
if (is_array($config['ttwitter::config']))
{
$this->tconfig = $config['ttwitter::config'];

postDM condition

postDM forces one to enter all 3 parameters when all that is needed is at least 2.
i.e user_id/screen_name and text

Override config settings for user tokens

Hey there,
I'm trying to use your library for allowing any registered user of my app to programatically post tweets. If I'm not mistaken, the current setup will just pull whatever token pair I choose to hardcode into the config. I'm wondering if there's a way to dynamically push the token creds of a currently logged in user to the twitter library?

Parameters for getOembed Required both ID or URL

GET statuses/oembed from twitter API only needs 1 parameter, ID or URL, but the selection condition needs both of those parameters to be there, you should change "OR" to "AND" to make it work I guess...

getMentionsTimeline works great on local dev server, but not production server?

Hey,

First of all - awesome amaze-balls work on this package. Much appreciate all the time an effort you took to make it! I use it as I want to list all the mentions a twitter handle gets, and twitters own lil' widget thingy is none too keen on doing that.

However - for some reason, the code I've made just ends up spitting out a NULL value. I should note I'm using your package with laravel 5 which seems to work fine on my dev server. However, having deployed the code to my dev server, the 'getMentionsTimeline()' function returns NULL.

I've tried catching exceptions, but nothing is thrown. Are there any other error functions built-in I can make use of? The best viable alternative I have at hand would be to start inserting code directly into the Twitter.php file, but that's such a tedious process when having to upload minute changes to my production server.

I briefly considered if there might be any issues related to oauth, but since the code running on the dev machine is identical to the production machine, I can't see what might be the problem?

Any ideas?

Thanks!
Gazoo

Error with sign-in inside Controller

Hi,

I've been using this package to connect to Twitter's API for a variety of uses and it's been great. However I have a consistent problem when trying to sign-in via Twitter.

I started off by using the code in your example for logging in and if I keep my version of that code in routes.php then everything works as expected.

The problem I have is that if I move that code into controller (so I can access useful methods before rendering the view) then I always run into problems. The request goes to Twitter, but then Twitter keeps reloading the token request page (https://api.twitter.com/oauth/authenticate?oauth_token=[removed]) without sending anything back to my callback (I am tracking requests on the network tab in Chrome's dev tools). Eventually I hit the Twitter API rate limits.

I'm using this with Laravel 5.

Here are the relevant snippets of code:

Route file contents

<?php
Route::get('twitter/login', ['as' => 'twitter.login', function(){
    // your SIGN IN WITH TWITTER  button should point to this route

    $sign_in_twitter = true;
    $force_login = false;

    // Make sure we make this request w/o tokens, overwrite the default values in case of login.
    Twitter::reconfig(['token' => '', 'secret' => '']);

    $token = Twitter::getRequestToken(route('twitter.callback'));

    if (isset($token['oauth_token_secret']))
    {
        $url = Twitter::getAuthorizeURL($token, $sign_in_twitter, $force_login);

        Session::put('oauth_state', 'start');
        Session::put('oauth_request_token', $token['oauth_token']);
        Session::put('oauth_request_token_secret', $token['oauth_token_secret']);

        return Redirect::to($url);
    }

    return Redirect::route('twitter.error');
}]);

Route::get('twitter/callback', ['as' => 'twitter.callback', 'uses' => 'SearchController@loginCallback']);

Route::get('twitter/signed-in', ['as' => 'twitter.signed-in', 'uses' => 'SearchController@signedIn']);


Route::get('twitter/error', ['as' => 'twitter.error', function(){
    return Redirect::to('/error')->with('flash_notice', 'Unfortunately, we couldn\'t log you in, please try again.');
}]);
?>

Controller file contents

<?php
public function loginCallback (Request $request)
    {
        if (Session::has('oauth_request_token'))
        {
            $request_token = [
                'token'  => Session::get('oauth_request_token'),
                'secret' => Session::get('oauth_request_token_secret'),
            ];

            Twitter::reconfig($request_token);

            $oauth_verifier = false;

            if (Input::has('oauth_verifier'))
            {
                $oauth_verifier = Input::get('oauth_verifier');
            }

            // getAccessToken() will reset the token for you
            $token = Twitter::getAccessToken($oauth_verifier);

            if (!isset($token['oauth_token_secret']))
            {
                return Redirect::route('twitter.login')->with('flash_error', 'We could not log you in on Twitter.');
            }

            $credentials = Twitter::getCredentials();

            if (is_object($credentials) && !isset($credentials->error))
            {

                Session::put('access_token', $token);
                Session::put('user_id', $credentials->id);
                Session::put('user_screen_name', $credentials->screen_name);
                Session::put('user_name', $credentials->name);
                Session::put('user_profile_image', $credentials->profile_image_url);

                return Redirect::route('twitter.signed-in');
            }

            return Redirect::route('twitter.error')->with('flash_error', 'Crab! Something went wrong while signing you up!');
        }
    }

    public function signedIn ()
    {
        $tweets_json = Twitter::getHomeTimeline(['count' => '80']);

        $user_bio = array();
        $user_bio['screen_name'] = Session::get('user_screen_name');
        $user_bio['user_name'] = Session::get('user_name');
        $user_bio['user_profile_image'] = Session::get('user_profile_image');

        return view('tweets', ['tweets' => $tweets_json, 'user_bio' => $user_bio]);
    }
?>

Any help you could provide would be amazing.

Thanks

Error With Authentication Data

Hello!

When I try to access the tweets in the home view, it would not work. So since then I printed out the response and got this, stdClass Object ( [errors] => Array ( [0] => stdClass Object ( [message] => Bad Authentication data [code] => 215 ) ) ) 1.

Any suggestions?

Fetch more than 15 results with getSearch

I'm trying to fetch all statuses containing a certain hashtag for a contest.

$tweets = Twitter::getSearch([
    'q' => '#ff', // using #ff for testing
    'until' => '2014-06-07',
    'rpp' => 100,
    'result_type' => 'recent'
]);

In docs, it says we can specify a rpp parameter to fetch up to 100 statuses. I tried it but unfortunately it doesn't retrieve more than 15 tweets at a time.

I also noticed there's a page parameter so I guess I could loop and fetch all of them that way but still I'd like to request more than 15 at a time.

NB: I'm using until to get all the entries up to a certain date. I'd like to specify a time but I didn't see anything about it in the API docs though.

Could somebody please tell me what is wrong that is preventing me to fetch 100 statuses in one request?

Thanks and have a nice weekend!

I kept digging in the problem with the json_decode I was posting on before.

In a controller I do this:

$response = Twitter::getSearch(array('q' => $q, 'count' => 5, 'lang' => 'sv', 'result_type' => 'recent'));
die(print_r($response));

locally it outputs a json-object:

{
"statuses": [
...
]
}

Pushing the exact same code to pagodabox, outputs a php-object:
stdClass Object ( [statuses] => Array ( ...) );

I can't really comperhend what might cause this.

postTweet simply doesn't work on my dev laptop

I have no idea why.

try {
    $response = Twitter::postTweet($tweet_opts);
    var_dump($response);
} catch(Exception $e) {
    echo $e->getMessage();
}

simply results in boolean false being displayed.

I'm stuck even trying to debug this.

Access methods in controllers

Hi,

I am new on laravel. We will use Twitter::(method) in routes.php but i want use in controllers. How can i do that ? I searched injection somewhere for this but not found.

Thanks.

class Twitter managing errors in Laravel 5 fails

In method query, this code fails when I get an error code from twitter api, php shows ErrorException in Twitter.php line 276:
Undefined index: message.

if (isset($response['code']) && $response['code'] != 200)
        {
            $_response = $this->jsonDecode($response['response'], true);

            if (array_key_exists('errors', $_response))
            {
                $error_msg = $_response['message'];
            }
            else
            {
                $error_msg = $_response['error'];
            }

            $this->log('ERROR_CODE : '.$response['code']);
            $this->log('ERROR_MSG : '.$error_msg);

            throw new Exception('['.$response['code'].'] '.$error_msg, $response['code']);
        }

My $_response prints;

Array
(
    [errors] => Array
        (
            [0] => Array
                (
                    [code] => 63
                    [message] => User has been suspended.
                )

        )

)

If I change code to read the array response correctly, it works

$error_msg = $_response['errors'][0]['message'];
$error_msg = $_response['errors'][0]['code'];

message":"Bad Authentication data","code":215

Just installed your package, Laravel 4.1 on Windows with PHP 5.4.27.

Route::get('/', function()
{
    //Returns a collection of the most recent Tweets posted by the user indicated by the screen_name or user_id parameters.
     return Twitter::getUserTimeline(array('screen_name' => 'LeszekDev', 'count' => 20, 'format' => 'json'));
});

I created account on dev.twitter.com and updated config.php with API keys.

AS I see on Google there are a lot of similar problems.

Can retrieve data, but can't get access token

Hello John,

I can execute this command Twitter::postTweet(array('status' => '[test tweet] Laravel is beautiful', 'format' => 'json')); and the tweet is posted on my account.

But $token = Twitter::getRequestToken($callback_url); is always return false.

So how can I authenticate other users?

Thanks

Required oauth_verifier parameter not provided

Hi,

Twitter Login was fine in homestead. Then i changed callback_url,website to production ip adresses and I get this error in storage logs. Im developing on laravel 5. How can i solve it ? Is there missing library in digitalocean ubuntu vps ?

[2015-05-05 11:42:24] production.ERROR: exception 'Exception' with message '

Required oauth_verifier parameter not provided
/oauth/access_token

' in /var/www/laravel/vendor/thujohn/twitter/src/Thujohn/Twitter/Twitter.php:197
Stack trace:
#0 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(210): Thujohn\Twitter\Twitter->getAccessToken(false)

Getting the returned tweet with linkify is not working

Hi,

I have been trying to use the Twitter::linkify($tweet); in my stream of tweets but I am unsure of what to do and how to get it to work with my foreach loop.

$tweets = Twitter::getSearch(array('q' => 'secretsocial', 'count' => 100, 'format' => 'array'));
Twitter::linkify($tweets);

foreach($tweets['statuses'] as $tweet) {
echo $tweet['text'];
}

Really not sure where to start with it

Wrong verification

These three functions postFollow, postUnfollow and postFollowUpdate have the following verification:

if (!array_key_exists('screen_name', $parameters) || !array_key_exists('user_id', $parameters)){
 throw new \Exception('Parameter required missing : screen_name or user_id');
}

In these methods, the items screen_name and user_id are optional, but we must send at least one of them. Under this verification we have to pass both of them, otherwise it throws the exception.

So, to correct it, it's just necessary switch the logical operator from OR to AND.

Cannot post tweet with a link

Not sure what is happening. No matter the length of the url or tweet message itself, it results in error 186 : Status is over 140 characters.

public function tweet($message = null) 
    {   
        $message    = ($message) ? $message : 'Check out '. Str::limit($this->title, 10, '...') .'!';
        $status     = $message. ' '. URL::route('project', urlencode($this->title));
        $status     = Twitter::linkify($status);

        return Twitter::postTweet(
            array(
                'status' => $status,
                'format' => 'json'
            )
        );
    }

What am I doing wrong?

linkTweet vs. linkify API inconsistency

Both linkTweet and linkify take a $tweet as an argument, but linkTweet expects an object and linkify expects a string (really $tweet->text). At the very least, updating the docs would be good, but I would think a better approach would be to pass the object for both functions and let the function do the right thing. Can submit a PR for either, but wanted to check if there was a preferred method.

Twitter::getSearch

please , how can i use the parameters 'geocode' and 'until' (to get tweets posted until 2 dates) on getSerach function ?

json_decode output as an array

I was wondering if you would like to add an option to most of the functions to make it possible to output the response from twitter as an array?

Something like this

public function getUserTimeline($parameters = array(), $decode_option = false){
    $response = $this->query('statuses/user_timeline', 'GET', 'json', $parameters);

    return json_decode($response,$decode_option);
}

This makes it a lot easier to use the response for me (and i guess some others), the solution above keeps the default to false, so it is up to the user to decide to turn it on. Currently I added the 'true' statement manually: json_decode($response,true), but if you update the code this will be undone :)

When will L5 version hit stable

Hi,

To install this package in L5 through composer I need to add "minimum-stability: "dev". for my production env I don't want that.

When will this hit stable?

Regards,
Ronnie

problem in tmhoauth

hi, i keep getting "Array to string conversion" error message from tmhoauth class when using your twitter class. the error message displays that the problem comes from line 399 which is
$this->request_settings['signing_key'] = $left . '&' . $right;

because your class extends the tmhoauth class, maybe you can give me some solution about this problem? thanks in advance!

Undefined ttwiter index

Hi, Mr. John, i got error when trying to initiate your package. It showed error like this :

ThanksForHelping 👍

ErrorException (E_UNKNOWN)

Undefined index: ttwitter::config
Open: /var/www/html/integration/vendor/thujohn/twitter/src/Thujohn/Twitter/Twitter.php

* Only for debugging
*/
private $debug;
private $log = [];
public function __construct($config = [], SessionStore $session)
{
if (is_array($config['ttwitter::config']))
{
$this->tconfig = $config['ttwitter::config'];

Use Twitter's "entities in objects" (Linkify)

Documentation is available here: https://dev.twitter.com/overview/api/entities-in-twitter-objects

It would allow to have the true full URL instead of the t.co one, and to match hashtags exactly as does Twitter.
Here is a code sample that does it. It's not perfect, and is not from me, so I won't PR it.

/**
 * addTweetEntityLinks
 *
 * adds a link around any entities in a twitter feed
 * twitter entities include urls, user mentions, and hashtags
 *
 * @author     Joe Sexton <[email protected]>
 * @param      object $tweet a JSON tweet object v1.1 API
 * @return     string tweet
 */
function addTweetEntityLinks( $tweet ){
    // actual tweet as a string
    $tweetText = $tweet->text;

    // create an array to hold urls
    $tweetEntites = array();

        // add each url to the array
        foreach( $tweet->entities->media as $media ) {
                $tweetEntites[] = array (
                                'type'    => 'media',
                                'curText' => substr( $tweetText, $media->indices[0], ( $media->indices[1] - $media->indices[0] ) ),
                                'newText' => "<a href='".$media->media_url_https."' target='_blank'>".$media->display_url."</a>"
                        );
        }  // end foreach

    // add each url to the array
    foreach( $tweet->entities->urls as $url ) {
        $tweetEntites[] = array (
                'type'    => 'url',
                'curText' => substr( $tweetText, $url->indices[0], ( $url->indices[1] - $url->indices[0] ) ),
                'newText' => "<a href='".$url->expanded_url."' target='_blank'>".$url->display_url."</a>"
            );
    }  // end foreach

    // add each user mention to the array
    foreach ( $tweet->entities->user_mentions as $mention ) {
        $string = substr( $tweetText, $mention->indices[0], ( $mention->indices[1] - $mention->indices[0] ) );
        $tweetEntites[] = array (
                'type'    => 'mention',
                'curText' => substr( $tweetText, $mention->indices[0], ( $mention->indices[1] - $mention->indices[0] ) ),
                'newText' => "<a href='https://twitter.com/".$mention->screen_name."' target='_blank'>".$string."</a>"
            );
    }  // end foreach

    // add each hashtag to the array
    foreach ( $tweet->entities->hashtags as $tag ) {
        $string = substr( $tweetText, $tag->indices[0], ( $tag->indices[1] - $tag->indices[0] ) );
        $tweetEntites[] = array (
                'type'    => 'hashtag',
                'curText' => substr( $tweetText, $tag->indices[0], ( $tag->indices[1] - $tag->indices[0] ) ),
                'newText' => "<a href='https://twitter.com/search?q=%23".$tag->text."&src=hash' target='_blank'>".$string."</a>"
            );
    }  // end foreach
    // replace the old text with the new text for each entity
    foreach ( $tweetEntites as $entity ) {
        $tweetText = str_replace( $entity['curText'], $entity['newText'], $tweetText );
    } // end foreach

    return $tweetText;

} // end addTweetEntityLinks()

Move tmhOAuth to Composer dependency

tmhOauth is currently hardcoded in the repository (which is very bad), shouldn't it be moved to a Composer dependency instead ?

"themattharris/tmhoauth": "dev-master"

syntax error, unexpected '['

    $default['token']  = Session::get('access_token')['oauth_token'];
    $default['secret'] = Session::get('access_token')['oauth_token_secret'];

vendor/thujohn/twitter/src/Thujohn/Twitter/Twitter.php

undefined constant CURL_HTTP_VERSION_1_1

I'm deploying to pagodabox and getting the following exception

Use of undefined constant CURL_HTTP_VERSION_1_1 - assumed 'CURL_HTTP_VERSION_1_1'

not sure what the right setting should be

Fail command "composer require thujohn/twitter"

- Installation request for thujohn/twitter ~1.2 -> satisfiable by thujohn/tw

itter[1.2.0].
- Conclusion: remove laravel/framework v5.0.13
- thujohn/twitter 1.2.0 requires illuminate/support 4.x -> satisfiable by il
luminate/support[v4.0.0, v4.0.1, v4.0.10, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6 ......

- don't install illuminate/support v4.0.0|don't install laravel/framework v5.0.13
- don't install illuminate/support v4.0.1|don't install laravel/framework v5.0.13
............

Installation failed, reverting ./composer.json to its original content.

Any help please in this error !!!

postTweet posting endlessly in command?

Hello,

I've been using this package for over a year now, this is the only time I've had an issue so first and foremost - thank you.

I've been using 2.0.*@dev for about a month now as suggested for Laravel 5. I was due to launch a Laravel 5 version of one of my sites this evening, when I hit a bit of a wall when running composer update on my production server. Of course, this package had updated since I last did a composer update on my local therefore my production was ahead.

So, the previous code I had was:

$twitter = \Twitter::postTweetMedia([
    'status' => twitter_status($photo->female),
    'media[]'=> file_get_contents($photo->path),
    'format' => 'json'
]);
$twitter = json_decode($twitter);

This was working perfectly up until about an hour ago when I updated the package locally to fix it here to ensure I can sleep happy.

Following the documentation provided, I've updated my config file (of which contains the new UPLOAD_URL, etc.) and have updated my code to be the following:

$media = \Twitter::uploadMedia([
    'media' => file_get_contents($photo->path)
]);

$twitter = \Twitter::postTweet([
    'status'    => twitter_status($photo->female),
    'media_ids' => $media->media_id_string
]);

$twitter = json_decode($twitter);

Now, this is working fine - but it has some odd behaviour. At least what I have experienced, the best way I can show you this is suggested you check out this screen recording - I quickly explain what's happening: https://www.youtube.com/watch?v=BhuzrzJL13I

Note, at the time of posting this - the video is still processing on the above link, but shouldn't take too long.

So to shorten down what I have done;

  • Pulled in latest updates for this package
  • Configured as per documentation
  • Adjust code to implement new Twitter uploading method
  • Code previously was fine (fired once), now continuously fires - doesn't stop until I manually stop the queue worker.

I hope you can help! Thanks, Joe.

Publish config fails in L5

Running the php artisan vendor:publish command fails with following error:

exception 'BadMethodCallException' with message 'Call to undefined method [package]'.

Best regards,
Ronnie Visser

Class 'App\Http\Controllers\Twitter' not found

Using Laravel v5.0.22

I have followed the installation instructions, it would appear that the class is being loaded, as I do not get an error complaining about the ServiceProvider, but it seems that the Facade does not resolve to the class.

Any ideas?

Using thujohn/twitter with philo/twitter

I'm writing a Laravel 4 app that uses the getUserTime function of Thujohn (and works wonderfully) but for another aspect of my app, I'm using philo/twitter's oauth (which also works very well). The problem is that the namespaces for both of the packages are the same. Do you have any suggestions on how to get the Thujohn package to be recognized specifically for the functions I need it for and have function calls get confused with the philo/twitter package? I tried renaming the alias, hardcoding the use in the controllers, etc. If it could be a clue to help you help me, I have noticed that when I reverse the order of the package listing in config/app.php that the opposite package will start working.
Any advice would be much appreciated! Thanks!!

problem with linkify and twitters url shortener service

Not sure what is causing this and not sure it it is linkyfy breaking the link or because twitter re-shortened a bit.ly link.

Here is the actual tweet
linkified_actual_tweet

Here it is output to my view
linkified

And here it is in devtools
linkified_devtools

I have another tweet where the user posted the full url and it comes through as a t.co link that works correctly so I'm assuming this is because it was only shortened once whereas the one in question was posted as bit.ly and then re-shortened by twitter to a t.co link.

Any suggestion to fix this?

Error uploading image

using Twitter::postTweetMedia() results in the following JSON response:

{ "errors" : [ { "code" : 189 , "message" : "Error creating status." } ] }

My $tweet_opts array that I pass into the function is constructed by using a string though:

$tweet_opts["media[]"] = '/path/to/file';

which is what I think the issue is. If I create a stream of the file like so:

$tweet_opts["media[]"] = fopen('/path/to/file', 'r');

then I get an exception from tmhOauth:

object(ErrorException)[281]
  protected 'message' => string 'strpos() expects parameter 1 to be string, resource given' (length=57)
  private 'string' (Exception) => string '' (length=0)
  protected 'code' => int 0
  protected 'file' => string '/Users/jonny/git/jbl4/vendor/themattharris/tmhoauth/tmhOAuth.php' (length=64)
  protected 'line' => int 300
  private 'trace' (Exception) => 
    array (size=27)
      0 => 
        array (size=4)
          'function' => string 'handleError' (length=11)
          'class' => string 'Illuminate\Exception\Handler' (length=28)
          'type' => string '->' (length=2)
          'args' => 
            array (size=5)
              ...
      1 => 
        array (size=4)
          'file' => string '/Users/jonny/git/jbl4/vendor/themattharris/tmhoauth/tmhOAuth.php' (length=64)
          'line' => int 300
          'function' => string 'strpos' (length=6)
          'args' => 
            array (size=2)
              ...
      2 => 
        array (size=6)
          'file' => string '/Users/jonny/git/jbl4/vendor/themattharris/tmhoauth/tmhOAuth.php' (length=64)
          'line' => int 355
          'function' => string 'multipart_escape' (length=16)
          'class' => string 'tmhOAuth' (length=8)
          'type' => string '->' (length=2)
          'args' => 
            array (size=1)
              ...
      3 => 
        array (size=6)
          'file' => string '/Users/jonny/git/jbl4/vendor/themattharris/tmhoauth/tmhOAuth.php' (length=64)
          'line' => int 561
          'function' => string 'prepare_params' (length=14)
          'class' => string 'tmhOAuth' (length=8)
          'type' => string '->' (length=2)
          'args' => 
            array (size=0)
              ...
      4 => 
        array (size=6)
          'file' => string '/Users/jonny/git/jbl4/vendor/themattharris/tmhoauth/tmhOAuth.php' (length=64)
          'line' => int 533
          'function' => string 'oauth1_request' (length=14)
          'class' => string 'tmhOAuth' (length=8)
          'type' => string '->' (length=2)
          'args' => 
            array (size=0)
              ...
      5 => 
        array (size=6)
          'file' => string '/Users/jonny/git/jbl4/vendor/thujohn/twitter/src/Thujohn/Twitter/Twitter.php' (length=76)
          'line' => int 45
          'function' => string 'user_request' (length=12)
          'class' => string 'tmhOAuth' (length=8)
          'type' => string '->' (length=2)
          'args' => 
            array (size=1)
              ...
      6 => 
        array (size=6)
          'file' => string '/Users/jonny/git/jbl4/vendor/thujohn/twitter/src/Thujohn/Twitter/Twitter.php' (length=76)
          'line' => int 288
          'function' => string 'query' (length=5)
          'class' => string 'Thujohn\Twitter\Twitter' (length=23)
          'type' => string '->' (length=2)
          'args' => 
            array (size=4)
              ...
      7 => 
        array (size=6)
          'file' => string '/Users/jonny/git/jbl4/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php' (length=88)
          'line' => int 208
          'function' => string 'postTweetMedia' (length=14)
          'class' => string 'Thujohn\Twitter\Twitter' (length=23)
          'type' => string '->' (length=2)
          'args' => 
            array (size=1)
              ...
      8 => 
        array (size=6)
          'file' => string '/Users/jonny/git/jbl4/app/controllers/AdminController.php' (length=57)
          'line' => int 296
          'function' => string '__callStatic' (length=12)
          'class' => string 'Illuminate\Support\Facades\Facade' (length=33)
          'type' => string '::' (length=2)
          'args' => 
            array (size=2)
              ...
      9 => 
        array (size=6)
          'file' => string '/Users/jonny/git/jbl4/app/controllers/AdminController.php' (length=57)
          'line' => int 296
          'function' => string 'postTweetMedia' (length=14)
          'class' => string 'Thujohn\Twitter\TwitterFacade' (length=29)
          'type' => string '::' (length=2)
          'args' => 
            array (size=1)
              ...
      10 => 
        array (size=4)
          'function' => string 'postNewNote' (length=11)
          'class' => string 'AdminController' (length=15)
          'type' => string '->' (length=2)
          'args' => 
            array (size=0)
              ...
      11 => 
        array (size=4)
          'file' => string '/Users/jonny/git/jbl4/vendor/laravel/framework/src/Illuminate/Routing/Controller.php' (length=84)
          'line' => int 231
          'function' => string 'call_user_func_array' (length=20)
          'args' => 
            array (size=2)
              ...
      12 => 
        array (size=6)
          'file' => string '/Users/jonny/git/jbl4/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php' (length=94)
          'line' => int 93
          'function' => string 'callAction' (length=10)
          'class' => string 'Illuminate\Routing\Controller' (length=29)
          'type' => string '->' (length=2)
          'args' => 
            array (size=2)
              ...
      13 => 
        array (size=6)
          'file' => string '/Users/jonny/git/jbl4/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php' (length=94)
          'line' => int 62
          'function' => string 'call' (length=4)
          'class' => string 'Illuminate\Routing\ControllerDispatcher' (length=39)
          'type' => string '->' (length=2)
          'args' => 
            array (size=3)
              ...
      14 => 
        array (size=6)
          'file' => string '/Users/jonny/git/jbl4/vendor/laravel/framework/src/Illuminate/Routing/Router.php' (length=80)
          'line' => int 930
          'function' => string 'dispatch' (length=8)
          'class' => string 'Illuminate\Routing\ControllerDispatcher' (length=39)
          'type' => string '->' (length=2)
          'args' => 
            array (size=4)
              ...
      15 => 
        array (size=4)
          'function' => string 'Illuminate\Routing\{closure}' (length=28)
          'class' => string 'Illuminate\Routing\Router' (length=25)
          'type' => string '->' (length=2)
          'args' => 
            array (size=0)
              ...
      16 => 
        array (size=4)
          'file' => string '/Users/jonny/git/jbl4/vendor/laravel/framework/src/Illuminate/Routing/Route.php' (length=79)
          'line' => int 105
          'function' => string 'call_user_func_array' (length=20)
          'args' => 
            array (size=2)
              ...
      17 => 
        array (size=6)
          'file' => string '/Users/jonny/git/jbl4/vendor/laravel/framework/src/Illuminate/Routing/Router.php' (length=80)
          'line' => int 996
          'function' => string 'run' (length=3)
          'class' => string 'Illuminate\Routing\Route' (length=24)
          'type' => string '->' (length=2)
          'args' => 
            array (size=1)
              ...
      18 => 
        array (size=6)
          'file' => string '/Users/jonny/git/jbl4/vendor/laravel/framework/src/Illuminate/Routing/Router.php' (length=80)
          'line' => int 964
          'function' => string 'dispatchToRoute' (length=15)
          'class' => string 'Illuminate\Routing\Router' (length=25)
          'type' => string '->' (length=2)
          'args' => 
            array (size=1)
              ...
      19 => 
        array (size=6)
          'file' => string '/Users/jonny/git/jbl4/vendor/laravel/framework/src/Illuminate/Foundation/Application.php' (length=88)
          'line' => int 738
          'function' => string 'dispatch' (length=8)
          'class' => string 'Illuminate\Routing\Router' (length=25)
          'type' => string '->' (length=2)
          'args' => 
            array (size=1)
              ...
      20 => 
        array (size=6)
          'file' => string '/Users/jonny/git/jbl4/vendor/laravel/framework/src/Illuminate/Foundation/Application.php' (length=88)
          'line' => int 708
          'function' => string 'dispatch' (length=8)
          'class' => string 'Illuminate\Foundation\Application' (length=33)
          'type' => string '->' (length=2)
          'args' => 
            array (size=1)
              ...
      21 => 
        array (size=6)
          'file' => string '/Users/jonny/git/jbl4/vendor/laravel/framework/src/Illuminate/Session/Middleware.php' (length=84)
          'line' => int 72
          'function' => string 'handle' (length=6)
          'class' => string 'Illuminate\Foundation\Application' (length=33)
          'type' => string '->' (length=2)
          'args' => 
            array (size=3)
              ...
      22 => 
        array (size=6)
          'file' => string '/Users/jonny/git/jbl4/vendor/laravel/framework/src/Illuminate/Cookie/Queue.php' (length=78)
          'line' => int 47
          'function' => string 'handle' (length=6)
          'class' => string 'Illuminate\Session\Middleware' (length=29)
          'type' => string '->' (length=2)
          'args' => 
            array (size=3)
              ...
      23 => 
        array (size=6)
          'file' => string '/Users/jonny/git/jbl4/vendor/laravel/framework/src/Illuminate/Cookie/Guard.php' (length=78)
          'line' => int 51
          'function' => string 'handle' (length=6)
          'class' => string 'Illuminate\Cookie\Queue' (length=23)
          'type' => string '->' (length=2)
          'args' => 
            array (size=3)
              ...
      24 => 
        array (size=6)
          'file' => string '/Users/jonny/git/jbl4/vendor/stack/builder/src/Stack/StackedHttpKernel.php' (length=74)
          'line' => int 23
          'function' => string 'handle' (length=6)
          'class' => string 'Illuminate\Cookie\Guard' (length=23)
          'type' => string '->' (length=2)
          'args' => 
            array (size=3)
              ...
      25 => 
        array (size=6)
          'file' => string '/Users/jonny/git/jbl4/vendor/laravel/framework/src/Illuminate/Foundation/Application.php' (length=88)
          'line' => int 606
          'function' => string 'handle' (length=6)
          'class' => string 'Stack\StackedHttpKernel' (length=23)
          'type' => string '->' (length=2)
          'args' => 
            array (size=1)
              ...
      26 => 
        array (size=6)
          'file' => string '/Users/jonny/git/jbl4/public/index.php' (length=38)
          'line' => int 49
          'function' => string 'run' (length=3)
          'class' => string 'Illuminate\Foundation\Application' (length=33)
          'type' => string '->' (length=2)
          'args' => 
            array (size=0)
              ...
  private 'previous' (Exception) => null
  protected 'severity' => int 2
  public 'xdebug_message' => string '<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> ErrorException: strpos() expects parameter 1 to be string, resource given in /Users/jonny/git/jbl4/vendor/themattharris/tmhoauth/tmhOAuth.php on line <i>300</i></th></tr>
<tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>
<tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Me'... (length=11085)

How to authenticate an user?

Hello @thujohn,

I've just added twitter-l4 to my Laravel project and I'm wondering how can I authenticate a user using your project. Do you have any example about how to do it?

Cheers!

tmhOAuth not found

Hey there,

Since the newest composer update, the class gives me errors. Any idea how to fix this?
Class 'Thujohn\Twitter\tmhOAuth' not found
* I'm still on Laravel 4.0.

Twitter::getRequestToken returns false

Hi!

I try to make very basic stuff, but can't make authorization to work properly.

Twitter::getRequestToken with original $callback_url and hardcoded url returns bool(false).
However, without passing the url, it redirects to Twitter authorization page, where I get the PIN code, but I don't want it to do the auth this way.

I'm pretty new to this, so technically I don't know what to look at, is it something wrong with those methods or twitter setup, so I would really appreciate any guidelines.

Application Only Authentication for REST API getSearch

I have looked through the code and can't tell if Application Only Authentication is working and enabled or not. If not, could you please make this a feature? Using it increases the amount or requests from 180 per 15 minutes to 450.

Internal error, code 131

Hi, I'm using this bundle on my laravel website. Randomly, when I use "getUserTimeline" method, the return value is an error object. This is the dumped response:

object(stdClass)#384 (1) {
["errors"]=> array(1) { [0]=> object(stdClass)#390 (2) { ["message"]=> string(14) "Internal error" ["code"]=> int(131) } }
}

Any idea to solve this issue?

Not working under L5

When using L5 the API always returns an error about the fact that SSL is required.

{#587
  +"errors": array:1 [
    0 => {#590
      +"message": "SSL is required"
      +"code": 92
    }
  ]
}

When I manualy set the value of $this->default['use_ssl'] to true, a new error appears:
(Should never be enything else than true anyway)

{#20
  +"errors": array:1 [
    0 => {#579
      +"message": "Sorry, that page does not exist"
      +"code": 34
    }
  ]
}

This error appears when collection Tweets via the method 'getUserTimeline'. But also on other methods. The cause of this problem can be found in the query method.

'url'       => parent::url(Config::get('thujohn/twitter::API_VERSION').'/'.$name),

The config value can't be retrieved so '1.X' is missing from the url

Some responses doesn't go through json_decode

First of love the app. This is my first experience with laravel (and extensions, and it's really easy to set up and run, amazing)

Some of the responses from twitter seem to be not json-strings or something. Here is the error:

UnexpectedValueException
The Response content must be a string or object implementing __toString(), "object" given.

the code that triggers it:
open: /bootstrap/compiled.php
flush();
}
return $this;
}
public function setContent($content)
{
if (null !== $content && !is_string($content) && !is_numeric($content) && !is_callable(array($content, '__toString'))) {
throw new \UnexpectedValueException(sprintf('The Response content must be a string or object implementing __toString(), "%s" given.', gettype($content)));
}
$this->content = (string) $content;

If I remove json_decode:
return $response;
//return json_decode($response);

Two examples(first, invalid key)

{"errors":[{"message":"Could not authenticate you","code":32}]}

function getSearch (q=cat count=5)

{"statuses":[{"metadata":{"result_type":"recent","iso_language_code":"en"},"created_at":"Thu Jul 25 13:14:47 +0000 2013","id":360387655147614208,"id_str":"360387655147614208","text":"My cat is the best cat in the world. Best friends http://t.co/FMLGP2qq6d","source":"\u003ca href="http://twitter.com/download/iphone" rel="nofollow"\u003eTwitter for iPhone\u003c/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":486668948,"id_str":"486668948","name":"Nick Benerakis","screen_name":"BenerakisFit","location":"Easthampton, MA","description":"ISSA Certified Personal Trainer. WNPF Powerlifter. Umass Amherst Kinesiology Major","url":"http://t.co/Qyuwznvf69","entities":{"url":{"urls":[{"url":"http://t.co/Qyuwznvf69","expanded_url":"http://benerakisfitness.com/","display_url":"benerakisfitness.com","indices":[0,22]}]},"description":{"urls":[]}},"protected":false,"followers_count":851,"friends_count":928,"listed_count":10,"created_at":"Wed Feb 08 14:51:15 +0000 2012","favourites_count":518,"utc_offset":null,"time_zone":null,"geo_enabled":true,"verified":false,"statuses_count":8401,"lang":"en","contributors_enabled":false,"is_translator":false,"profile_background_color":"022330","profile_background_image_url":"http://a0.twimg.com/profile_background_images/419661641/fitness.jpg","profile_background_image_url_https":"https://si0.twimg.com/profile_background_images/419661641/fitness.jpg","profile_background_tile":false,"profile_image_url":"http://a0.twimg.com/profile_images/378800000173816211/e1d77b4fe609bf0b283a6bbfc52f80c1_normal.jpeg","profile_image_url_https":"https://si0.twimg.com/profile_images/378800000173816211/e1d77b4fe609bf0b283a6bbfc52f80c1_normal.jpeg","profile_banner_url":"https://pbs.twimg.com/profile_banners/486668948/1374274168","profile_link_color":"0084B4","profile_sidebar_border_color":"C0DEED","profile_sidebar_fill_color":"DDEEF6","profile_text_color":"333333","profile_use_background_image":true,"default_profile":false,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false},"geo":null,"coordinates":null,"place":null,"contributors":null,"retweet_count":0,"favorite_count":0,"entities":{"hashtags":[],"symbols":[],"urls":[],"user_mentions":[],"media":[{"id":360387655151808512,"id_str":"360387655151808512","indices":[50,72],"media_url":"http://pbs.twimg.com/media/BQBaqbbCcAAMmb3.jpg","media_url_https":"https://pbs.twimg.com/media/BQBaqbbCcAAMmb3.jpg","url":"http://t.co/FMLGP2qq6d","display_url":"pic.twitter.com/FMLGP2qq6d","expanded_url":"http://twitter.com/BenerakisFit/status/360387655147614208/photo/1","type":"photo","sizes":{"medium":{"w":600,"h":600,"resize":"fit"},"thumb":{"w":150,"h":150,"resize":"crop"},"large":{"w":1024,"h":1024,"resize":"fit"},"small":{"w":340,"h":340,"resize":"fit"}}}]},"favorited":false,"retweeted":false,"possibly_sensitive":false,"lang":"en"},{"metadata":{"result_type":"recent","iso_language_code":"ja"},"created_at":"Thu Jul 25 13:14:47 +0000 2013","id":360387654648467459,"id_str":"360387654648467459","text":"\u540c\u5c0f\u266a\u540c\u4e2d\u266a\n\u5c0f\u5b66\u751f\u306e\u3068\u304d\u4e00\u5ea6\u904a\u3093\u3060\n\u3053\u3068\u306e\u3042\u308b\u4e0d\u601d\u8b70\u306a\u4ef2ww\n\u7d30\u3044\u3088\u306d\u30fc\u305d\u3057\u3066\u80cc\u304c\u9ad8\u3043\n\u8272\u304c\u9ed2\u3044\u3068\u3053\u304c\u4f3c\u5408\u3063\u3066\u308b(\u00b4\u2200`)\n\u5999\u306b\u9762\u767d\u3044w\n #\u3075\u3041\u307c\u3063\u305f\u30d5\u30a9\u30ed\u30ef\u30fc\u3055\u3093\u3092\u540d\u524d\u3060\u3055\u305a\u306b\u8a9e\u308b","source":"\u003ca href="http://twitter.com/download/iphone" rel="nofollow"\u003eTwitter for iPhone\u003c/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":1612505394,"id_str":"1612505394","name":"\u305f\u304b_(\u51fa\u623b\u308a)","screen_name":"takakara_cat","location":"\u3054\u3081\u3093\u306a\u3055\u3043\u51fa\u623b\u308a\u3067\u3059!!","description":"\uff0a\uff0a\uff0awas. nissin - now. auea 2525\uff0a\uff0a\uff0a *follow me_","url":null,"entities":{"description":{"urls":[]}},"protected":false,"followers_count":169,"friends_count":265,"listed_count":0,"created_at":"Mon Jul 22 10:28:54 +0000 2013","favourites_count":26,"utc_offset":null,"time_zone":null,"geo_enabled":false,"verified":false,"statuses_count":112,"lang":"ja","contributors_enabled":false,"is_translator":false,"profile_background_color":"C0DEED","profile_background_image_url":"http://a0.twimg.com/images/themes/theme1/bg.png","profile_background_image_url_https":"https://si0.twimg.com/images/themes/theme1/bg.png","profile_background_tile":false,"profile_image_url":"http://a0.twimg.com/profile_images/378800000170624336/eea00b30790a379d61c31c7dabb02921_normal.jpeg","profile_image_url_https":"https://si0.twimg.com/profile_images/378800000170624336/eea00b30790a379d61c31c7dabb02921_normal.jpeg","profile_banner_url":"https://pbs.twimg.com/profile_banners/1612505394/1374495267","profile_link_color":"0084B4","profile_sidebar_border_color":"C0DEED","profile_sidebar_fill_color":"DDEEF6","profile_text_color":"333333","profile_use_background_image":true,"default_profile":true,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false},"geo":null,"coordinates":null,"place":null,"contributors":null,"retweet_count":0,"favorite_count":0,"entities":{"hashtags":[{"text":"\u3075\u3041\u307c\u3063\u305f\u30d5\u30a9\u30ed\u30ef\u30fc\u3055\u3093\u3092\u540d\u524d\u3060\u3055\u305a\u306b\u8a9e\u308b","indices":[73,95]}],"symbols":[],"urls":[],"user_mentions":[]},"favorited":false,"retweeted":false,"lang":"ja"},{"metadata":{"result_type":"recent","iso_language_code":"ja"},"created_at":"Thu Jul 25 13:14:47 +0000 2013","id":360387654237429760,"id_str":"360387654237429760","text":"\u4eca\u306f\u30b5\u30fc\u30ad\u30e5\u30ec\u30fc\u30bf\u30fc\u306e\u7bb1\u304c\u304a\u6c17\u306b\u5165\u308a\u305f\u3093 #cat#catstagram#neko#\u732b http://t.co/coTQdAfy9l","source":"\u003ca href="http://instagram.com" rel="nofollow"\u003eInstagram\u003c/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":94048731,"id_str":"94048731","name":"\u7531\u307f\u305f","screen_name":"ajipota_ymt","location":"\u6771\u4eac\u90fd\u7df4\u99ac\u533a","description":"\u9676\u5668\u88fd\u4f5c \u9bf5\u307d\u305f\u5c4b\u306e\u304a\u77e5\u3089\u305b\u3084\u4f5c\u54c1\u3089\u304f\u304c\u304d\u30a4\u30f3\u30b9\u30bf\u30b0\u30e9\u30e0\u306e\u5199\u771f\u306a\u3069\u3002\u3042\u3068\u306f\u30d6\u30ed\u30b0\u3067\u3061\u308d\u3061\u308d\u3068\u3002\u697d\u3057\u304f\u307e\u3058\u3081\u306b\u3075\u3056\u3051\u308b\u4fc2\u3002","url":"http://t.co/1PCfPXwCVN","entities":{"url":{"urls":[{"url":"http://t.co/1PCfPXwCVN","expanded_url":"http://zeripota.tumblr.com/","display_url":"zeripota.tumblr.com","indices":[0,22]}]},"description":{"urls":[]}},"protected":false,"followers_count":250,"friends_count":184,"listed_count":18,"created_at":"Wed Dec 02 08:26:08 +0000 2009","favourites_count":7,"utc_offset":32400,"time_zone":"Tokyo","geo_enabled":true,"verified":false,"statuses_count":9977,"lang":"ja","contributors_enabled":false,"is_translator":false,"profile_background_color":"FFFFFF","profile_background_image_url":"http://a0.twimg.com/profile_background_images/687724399/22a77411203e8413b26dc2ceb2fa2fb3.jpeg","profile_background_image_url_https":"https://si0.twimg.com/profile_background_images/687724399/22a77411203e8413b26dc2ceb2fa2fb3.jpeg","profile_background_tile":false,"profile_image_url":"http://a0.twimg.com/profile_images/344513261567395813/b51542e611a549ca974083da69439565_normal.jpeg","profile_image_url_https":"https://si0.twimg.com/profile_images/344513261567395813/b51542e611a549ca974083da69439565_normal.jpeg","profile_banner_url":"https://pbs.twimg.com/profile_banners/94048731/1354293186","profile_link_color":"0099B9","profile_sidebar_border_color":"FFFFFF","profile_sidebar_fill_color":"95E8EC","profile_text_color":"3C3940","profile_use_background_image":true,"default_profile":false,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false},"geo":null,"coordinates":null,"place":null,"contributors":null,"retweet_count":0,"favorite_count":0,"entities":{"hashtags":[],"symbols":[],"urls":[{"url":"http://t.co/coTQdAfy9l","expanded_url":"http://instagram.com/p/cMLGyGDrdD/","display_url":"instagram.com/p/cMLGyGDrdD/","indices":[44,66]}],"user_mentions":[]},"favorited":false,"retweeted":false,"possibly_sensitive":false,"lang":"ja"},{"metadata":{"result_type":"recent","iso_language_code":"ja"},"created_at":"Thu Jul 25 13:14:46 +0000 2013","id":360387652777803777,"id_str":"360387652777803777","text":"RT @PokoSatou: \u306a\u306b\u304b\u3092\u611f\u3058\u305f\u4eba\u306fRT http://t.co/9TO7qcFMQ9","source":"\u003ca href="http://twitter.com/download/iphone" rel="nofollow"\u003eTwitter for iPhone\u003c/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":382951787,"id_str":"382951787","name":"\u732b\u6d77\u6708(=^x^=)","screen_name":"cat_jellyf_55","location":"\u611b\u77e5\u770c","description":"JK3 \u7d61\u3093\u3067\u304f\u308c\u308b\u3068\u5b09\u3057\u3044\u3067\u3059(^\u30fb\u03c9\u30fb^\u273f) \u30d5\u30a9\u30ed\u30fc\u304a\u9858\u3044\u3057\u307e\u3059\uff01 \u30a2\u30cb\u30e1/\u30cb\u30b3\u52d5\u306a\u3069\u306b\u30cf\u30de\u3063\u3066\u307e\u3059\u266a\u266a \u8a73\u3057\u304f\u306f\u2193\u2193","url":"http://t.co/nPHo8yv92l","entities":{"url":{"urls":[{"url":"http://t.co/nPHo8yv92l","expanded_url":"http://twpf.jp/cat_jellyf_55","display_url":"twpf.jp/cat_jellyf_55","indices":[0,22]}]},"description":{"urls":[]}},"protected":false,"followers_count":552,"friends_count":506,"listed_count":2,"created_at":"Sat Oct 01 00:28:34 +0000 2011","favourites_count":448,"utc_offset":28800,"time_zone":"Taipei","geo_enabled":false,"verified":false,"statuses_count":9494,"lang":"ja","contributors_enabled":false,"is_translator":false,"profile_background_color":"B2DFDA","profile_background_image_url":"http://a0.twimg.com/images/themes/theme13/bg.gif","profile_background_image_url_https":"https://si0.twimg.com/images/themes/theme13/bg.gif","profile_background_tile":false,"profile_image_url":"http://a0.twimg.com/profile_images/378800000000596814/12375b75519fd876e2c67429a190651c_normal.jpeg","profile_image_url_https":"https://si0.twimg.com/profile_images/378800000000596814/12375b75519fd876e2c67429a190651c_normal.jpeg","profile_banner_url":"https://pbs.twimg.com/profile_banners/382951787/1374480459","profile_link_color":"93A644","profile_sidebar_border_color":"EEEEEE","profile_sidebar_fill_color":"FFFFFF","profile_text_color":"333333","profile_use_background_image":true,"default_profile":false,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false},"geo":null,"coordinates":null,"place":null,"contributors":null,"retweeted_status":{"metadata":{"result_type":"recent","iso_language_code":"ja"},"created_at":"Thu Jul 25 13:08:21 +0000 2013","id":360386038591524864,"id_str":"360386038591524864","text":"\u306a\u306b\u304b\u3092\u611f\u3058\u305f\u4eba\u306fRT http://t.co/9TO7qcFMQ9","source":"web","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":1335401580,"id_str":"1335401580","name":"\u307d\u3053\u304d\u306e\uff08\u6b4c\u3044\u624b\u306b\u306a\u308a\u305f\u3044\u4eba\uff09","screen_name":"PokoSatou","location":"","description":"\u307d\u3053\u304d\u306e\u3067\uff5e\u3059\u3002\u308b\u30fc\u3075\u3041\u3044\u3068\u304b\u30de\u30b8\u5927\u597d\u304d\u3002\u3042\u3068\u3001\u6b4c\u304c\u4e0a\u624b\u304f\u306a\u308b\u65b9\u6cd5\u304c\u3042\u3063\u305f\u3089\u304a\u3057\u3048\u3066\u3061\u3087\u3002\u3067\u304d\u308b\u3060\u3051\u6bce\u65e5\u30c4\u30a4\u30fc\u30c8\u3059\u308b\u304b\u3089\u3088\u308d\u3057\u304f\u3067\u3059\u3002","url":null,"entities":{"description":{"urls":[]}},"protected":false,"followers_count":275,"friends_count":742,"listed_count":1,"created_at":"Mon Apr 08 00:44:21 +0000 2013","favourites_count":8,"utc_offset":null,"time_zone":null,"geo_enabled":false,"verified":false,"statuses_count":1484,"lang":"ja","contributors_enabled":false,"is_translator":false,"profile_background_color":"ACDED6","profile_background_image_url":"http://a0.twimg.com/images/themes/theme18/bg.gif","profile_background_image_url_https":"https://si0.twimg.com/images/themes/theme18/bg.gif","profile_background_tile":false,"profile_image_url":"http://a0.twimg.com/profile_images/378800000186033918/261d198354c11a11a878f85fe38f72bc_normal.jpeg","profile_image_url_https":"https://si0.twimg.com/profile_images/378800000186033918/261d198354c11a11a878f85fe38f72bc_normal.jpeg","profile_link_color":"038543","profile_sidebar_border_color":"EEEEEE","profile_sidebar_fill_color":"F6F6F6","profile_text_color":"333333","profile_use_background_image":true,"default_profile":false,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false},"geo":null,"coordinates":null,"place":null,"contributors":null,"retweet_count":7,"favorite_count":1,"entities":{"hashtags":[],"symbols":[],"urls":[],"user_mentions":[],"media":[{"id":360386038595719169,"id_str":"360386038595719169","indices":[12,34],"media_url":"http://pbs.twimg.com/media/BQBZMVSCEAEh6MF.gif","media_url_https":"https://pbs.twimg.com/media/BQBZMVSCEAEh6MF.gif","url":"http://t.co/9TO7qcFMQ9","display_url":"pic.twitter.com/9TO7qcFMQ9","expanded_url":"http://twitter.com/PokoSatou/status/360386038591524864/photo/1","type":"photo","sizes":{"thumb":{"w":150,"h":150,"resize":"crop"},"large":{"w":480,"h":225,"resize":"fit"},"small":{"w":340,"h":159,"resize":"fit"},"medium":{"w":480,"h":225,"resize":"fit"}}}]},"favorited":false,"retweeted":false,"possibly_sensitive":false,"lang":"ja"},"retweet_count":7,"favorite_count":0,"entities":{"hashtags":[],"symbols":[],"urls":[],"user_mentions":[{"screen_name":"PokoSatou","name":"\u307d\u3053\u304d\u306e\uff08\u6b4c\u3044\u624b\u306b\u306a\u308a\u305f\u3044\u4eba\uff09","id":1335401580,"id_str":"1335401580","indices":[3,13]}],"media":[{"id":360386038595719169,"id_str":"360386038595719169","indices":[27,49],"media_url":"http://pbs.twimg.com/media/BQBZMVSCEAEh6MF.gif","media_url_https":"https://pbs.twimg.com/media/BQBZMVSCEAEh6MF.gif","url":"http://t.co/9TO7qcFMQ9","display_url":"pic.twitter.com/9TO7qcFMQ9","expanded_url":"http://twitter.com/PokoSatou/status/360386038591524864/photo/1","type":"photo","sizes":{"thumb":{"w":150,"h":150,"resize":"crop"},"large":{"w":480,"h":225,"resize":"fit"},"small":{"w":340,"h":159,"resize":"fit"},"medium":{"w":480,"h":225,"resize":"fit"}},"source_status_id":360386038591524864,"source_status_id_str":"360386038591524864"}]},"favorited":false,"retweeted":false,"possibly_sensitive":false,"lang":"ja"},{"metadata":{"result_type":"recent","iso_language_code":"tr"},"created_at":"Thu Jul 25 13:14:46 +0000 2013","id":360387652375162882,"id_str":"360387652375162882","text":"RT @Instagram_tr: Akl\u0131m\u0131za gelmeyen \u015fark\u0131 isimlerini m\u0131r\u0131ldan\u0131nca \u00e7at diye bulan bir program yap\u0131n.Ziyan oldum.","source":"\u003ca href="http://twitter.com/download/android" rel="nofollow"\u003eTwitter for Android\u003c/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":180713717,"id_str":"180713717","name":"Ferhat KARADA\u011e","screen_name":"uykumvar_ulan","location":"\u015firinini ar\u0131yor :))","description":"bi k\u00f6\u015fede uyuyorum'dur","url":null,"entities":{"description":{"urls":[]}},"protected":false,"followers_count":126,"friends_count":75,"listed_count":0,"created_at":"Fri Aug 20 08:31:21 +0000 2010","favourites_count":1379,"utc_offset":10800,"time_zone":"Athens","geo_enabled":true,"verified":false,"statuses_count":8680,"lang":"tr","contributors_enabled":false,"is_translator":false,"profile_background_color":"EBC1C1","profile_background_image_url":"http://a0.twimg.com/profile_background_images/745690207/235c41f0967c85760c9ea3d9378883eb.jpeg","profile_background_image_url_https":"https://si0.twimg.com/profile_background_images/745690207/235c41f0967c85760c9ea3d9378883eb.jpeg","profile_background_tile":true,"profile_image_url":"http://a0.twimg.com/profile_images/378800000012607004/6770aeff66c9a8aa5257b76ad3fcde92_normal.jpeg","profile_image_url_https":"https://si0.twimg.com/profile_images/378800000012607004/6770aeff66c9a8aa5257b76ad3fcde92_normal.jpeg","profile_banner_url":"https://pbs.twimg.com/profile_banners/180713717/1369841244","profile_link_color":"B30000","profile_sidebar_border_color":"FFFFFF","profile_sidebar_fill_color":"DDEEF6","profile_text_color":"333333","profile_use_background_image":true,"default_profile":false,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false},"geo":null,"coordinates":null,"place":null,"contributors":null,"retweeted_status":{"metadata":{"result_type":"recent","iso_language_code":"tr"},"created_at":"Thu Jul 25 12:37:18 +0000 2013","id":360378223097417729,"id_str":"360378223097417729","text":"Akl\u0131m\u0131za gelmeyen \u015fark\u0131 isimlerini m\u0131r\u0131ldan\u0131nca \u00e7at diye bulan bir program yap\u0131n.Ziyan oldum.","source":"\u003ca href="http://twitter.com/#!/download/ipad" rel="nofollow"\u003eTwitter for iPad\u003c/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":592178615,"id_str":"592178615","name":"Instagram\u00ae","screen_name":"Instagram_tr","location":"","description":"Burada Okuduklar\u0131n\u0131z \u00c7ok Farkl\u0131 Olacak. (Hi\u00e7bir Kurumla ilgisi yoktur.) \r\nReklam i\u00e7in; http://t.co/hS6dVuXGJ9","url":null,"entities":{"description":{"urls":[{"url":"http://t.co/hS6dVuXGJ9","expanded_url":"http://www.bomedya.com","display_url":"bomedya.com","indices":[87,109]}]}},"protected":false,"followers_count":134041,"friends_count":23,"listed_count":106,"created_at":"Sun May 27 22:07:54 +0000 2012","favourites_count":367,"utc_offset":10800,"time_zone":"Istanbul","geo_enabled":false,"verified":false,"statuses_count":7073,"lang":"tr","contributors_enabled":false,"is_translator":false,"profile_background_color":"FFFFFF","profile_background_image_url":"http://a0.twimg.com/profile_background_images/344918034409724545/4b11627776ac202da6caccc2f6961c7b.jpeg","profile_background_image_url_https":"https://si0.twimg.com/profile_background_images/344918034409724545/4b11627776ac202da6caccc2f6961c7b.jpeg","profile_background_tile":false,"profile_image_url":"http://a0.twimg.com/profile_images/2831760684/03862677af810b77e70356ad438bfb78_normal.png","profile_image_url_https":"https://si0.twimg.com/profile_images/2831760684/03862677af810b77e70356ad438bfb78_normal.png","profile_banner_url":"https://pbs.twimg.com/profile_banners/592178615/1371770047","profile_link_color":"0084B4","profile_sidebar_border_color":"FFFFFF","profile_sidebar_fill_color":"DDEEF6","profile_text_color":"333333","profile_use_background_image":true,"default_profile":false,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false},"geo":null,"coordinates":null,"place":null,"contributors":null,"retweet_count":219,"favorite_count":90,"entities":{"hashtags":[],"symbols":[],"urls":[],"user_mentions":[]},"favorited":false,"retweeted":false,"lang":"tr"},"retweet_count":219,"favorite_count":0,"entities":{"hashtags":[],"symbols":[],"urls":[],"user_mentions":[{"screen_name":"Instagram_tr","name":"Instagram\u00ae","id":592178615,"id_str":"592178615","indices":[3,16]}]},"favorited":false,"retweeted":false,"lang":"tr"}],"search_metadata":{"completed_in":0.023,"max_id":360387655147614208,"max_id_str":"360387655147614208","next_results":"?max_id=360387652375162881&q=cat&count=5&include_entities=1","query":"cat","refresh_url":"?since_id=360387655147614208&q=cat&include_entities=1","count":5,"since_id":0,"since_id_str":"0"}}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.