Twitter with OAuth class
Possible Methods
- __construct
- setOAuthToken
- setOAuthTokenSecret
- setTimeOut
- setUserAgent
- statusesPublicTimeline
- statusesHomeTimeline
- statusesFriendsTimeline
- statusesUserTimeline
- statusesMentions
- statusesRetweetedByMe
- statusesRetweetedToMe
- statusesReweetsOfMe
- statusesShow
- statusesUpdate
- statusesDestroy
- statusesRetweet
- statusesRetweets
- statusesIdRetweetedBy
- statusesIdRetweetedByIds
- usersShow
- usersLookup
- usersSearch
- usersSuggestions
- usersSuggestionsSlug
- statusesFriends
- statusesFollowers
- trends
- trendsCurrent
- trendsDaily
- trendsWeekly
- userListsCreate
- userLists
- userListsId
- userListsIdUpdate
- userListsIdStatuses
- userListsMemberships
- userListsSubscriptions
- userListMembers
- userListMembersCreate
- userListMembersDelete
- userListMembersId
- userListSubscribers
- userListSubscribersCreate
- userListSubscribersDelete
- userListSubscribersId
- directMessages
- directMessagesSent
- directMessagesNew
- directMessagesDestroy
- friendshipsCreate
- friendshipsDestroy
- friendshipsExists
- friendshipsShow
- friendshipsIncoming
- friendshipsOutgoing
- friendsIds
- followersIds
- accountVerifyCredentials
- accountRateLimitStatus
- accountEndSession
- accountUpdateDeliveryDevices
- accountUpdateProfileColors
- accountUpdateProfileImage
- accountUpdateProfileBackgroundImage
- accountUpdateProfile
- favorites
- favoritesCreate
- favoritesDestroy
- notificationsFollow
- notificationsLeave
- blocksCreate
- blocksDestroy
- blocksExists
- blocksBlocking
- blocksBlockingIds
- reportSpam
- savedSearches
- savedSearchesShow
- savedSearchesCreate
- savedSearchesDestroy
- oAuthRequestToken
- oAuthAccessToken
- oAuthAuthorize
- oAuthAuthenticate
- trendsAvailable
- trendsLocation
- geoReverseGeoCode
- geoId
- helpTest
__construct
Default constructor
Parameters
- consumerKey string
- The consumer key to use.
- consumerSecret string
- The consumer secret to use.
Return
void
Example
<?php
// require
require_once 'twitter.php';
// create instance
$twitter = new Twitter('<your-consumer-key>', '<your-consumer-secret>');
// get a request token
$twitter->oAuthRequestToken('<your-callback-url>');
// authorize
if(!isset($_GET['oauth_token'])) $twitter->oAuthAuthorize();
// get tokens
$response = $twitter->oAuthAccessToken($_GET['oauth_token'], $_GET['oauth_verifier']);
// output, you can use the token for setOAuthToken and setOAuthTokenSecret
var_dump($response);
?>
setOAuthToken
Set the oAuth-token
Parameters
- token string
- The token to use.
Return
void
setOAuthTokenSecret
Set the oAuth-secret
Parameters
- secret string
- The secret to use.
Return
void
setTimeOut
Set the timeout
Parameters
- seconds int
- The timeout in seconds
Return
void
setUserAgent
Get the useragent that will be used. Our version will be prepended to yours.
It will look like: "PHP Twitter/<version> <your-user-agent>"
Parameters
- userAgent string
- Your user-agent, it should look like <app-name>/<app-version>
Return
void
statusesPublicTimeline
Returns the 20 most recent statuses from non-protected users who have set a custom user icon.
The public timeline is cached for 60 seconds and requesting it more often than that is unproductive and a waste of resources.
Parameters
- skipUser bool (optional)
- When true each tweet returned in a timeline will not contain an entire user object. Instead, the user node will contain only an id element to indicate the numerical ID of the Twitter user that set the status.
Return
array
statusesHomeTimeline
Returns the 20 most recent statuses posted by the authenticating user and that user's friends. This is the equivalent of /timeline/home on the Web.
Parameters
- sinceId string (optional)
- Returns results with an ID greater than (that is, more recent than) the specified ID.
- maxId string (optional)
- Returns results with an ID less than (that is, older than) or equal to the specified ID.
- count int (optional)
- Specifies the number of records to retrieve. May not be greater than 200.
- page int (optional)
- Specifies the page of results to retrieve.
- skipUser bool (optional)
- When true each tweet returned in a timeline will not contain an entire user object. Instead, the user node will contain only an id element to indicate the numerical ID of the Twitter user that set the status.
Return
array
statusesFriendsTimeline
Returns the 20 most recent statuses, including retweets, posted by the authenticating user and that user's friends.
This is the equivalent of /timeline/home on the Web.
Usage note: This home_timeline call is identical to statuses/friends_timeline, except that home_timeline also contains retweets, while statuses/friends_timeline does not for backwards compatibility reasons.
In a future version of the API, statuses/friends_timeline will be deprected and replaced by home_timeline.
Parameters
- sinceId string (optional)
- Returns results with an ID greater than (that is, more recent than) the specified ID.
- maxId string (optional)
- Returns results with an ID less than (that is, older than) or equal to the specified ID.
- count int (optional)
- Specifies the number of records to retrieve. May not be greater than 200.
- page int (optional)
- Specifies the page of results to retrieve.
- skipUser bool (optional)
- When true each tweet returned in a timeline will not contain an entire user object. Instead, the user node will contain only an id element to indicate the numerical ID of the Twitter user that set the status.
Return
array
statusesUserTimeline
Returns the 20 most recent statuses posted from the authenticating user. It's also possible to request another user's timeline via the id parameter.
This is the equivalent of the Web / page for your own user, or the profile page for a third party.
For backwards compatibility reasons, retweets are stripped out of the user_timeline when calling in XML or JSON (they appear with 'RT' in RSS and Atom).
If you'd like them included, you can merge them in from statuses retweeted_by_me.
Parameters
- id string (optional)
- Specifies the ID or screen name of the user for whom to return results for.
- userId string (optional)
- Specfies the ID of the user for whom to return results for. Helpful for disambiguating when a valid user ID is also a valid screen name.
- screenName string (optional)
- Specfies the screen name of the user for whom to return results for. Helpful for disambiguating when a valid screen name is also a user ID.
- sinceId string (optional)
- Returns results with an ID greater than (that is, more recent than) the specified ID.
- maxId string (optional)
- Returns results with an ID less than (that is, older than) or equal to the specified ID.
- count int (optional)
- Specifies the number of records to retrieve. May not be greater than 200.
- page int (optional)
- Specifies the page of results to retrieve.
- skipUser bool (optional)
- When true each tweet returned in a timeline will not contain an entire user object. Instead, the user node will contain only an id element to indicate the numerical ID of the Twitter user that set the status.
Return
array
Example
<?php
// require
require_once 'twitter.php';
// create instance
$twitter = new Twitter('<your-consumer-key>', '<your-consumer-secret>');
// set tokens
$twitter->setOAuthToken('<your-token>');
$twitter->setOAuthTokenSecret('<your-token-secret>');
// get users timeline
$response = $twitter->statusesUserTimeline();
// output
var_dump($response);
?>
statusesMentions
Returns the 20 most recent mentions (status containing @username) for the authenticating user.
Parameters
- sinceId string (optional)
- Returns results with an ID greater than (that is, more recent than) the specified ID.
- maxId string (optional)
- Returns results with an ID less than (that is, older than) or equal to the specified ID.
- count int (optional)
- Specifies the number of records to retrieve. May not be greater than 200.
- page int (optional)
- Specifies the page of results to retrieve.
Return
array
statusesRetweetedByMe
Returns the 20 most recent retweets posted by the authenticating user.
Parameters
- sinceId string (optional)
- Returns results with an ID greater than (that is, more recent than) the specified ID.
- maxId string (optional)
- Returns results with an ID less than (that is, older than) or equal to the specified ID.
- count int (optional)
- Specifies the number of records to retrieve. May not be greater than 200.
- page int (optional)
- Specifies the page of results to retrieve.
Return
array
statusesRetweetedToMe
Returns the 20 most recent retweets posted by the authenticating user's friends.
Parameters
- sinceId string (optional)
- Returns results with an ID greater than (that is, more recent than) the specified ID.
- maxId string (optional)
- Returns results with an ID less than (that is, older than) or equal to the specified ID.
- count int (optional)
- Specifies the number of records to retrieve. May not be greater than 200.
- page int (optional)
- Specifies the page of results to retrieve.
Return
array
statusesReweetsOfMe
Returns the 20 most recent tweets of the authenticated user that have been retweeted by others.
Parameters
- sinceId string (optional)
- Returns results with an ID greater than (that is, more recent than) the specified ID.
- maxId string (optional)
- Returns results with an ID less than (that is, older than) or equal to the specified ID.
- count int (optional)
- Specifies the number of records to retrieve. May not be greater than 200.
- page int (optional)
- Specifies the page of results to retrieve.
Return
array
statusesShow
Returns a single status, specified by the id parameter below. The status's author will be returned inline.
Parameters
- id string
- The numerical ID of the desired status.
Return
array
statusesUpdate
Updates the authenticating user's status. A status update with text identical to the authenticating user's text identical to the authenticating user's current status will be ignored to prevent duplicates.
Parameters
- status string
- The text of your status update, up to 140 characters. URL encode as necessary.
- inReplyToStatusId string (optional)
- The ID of an existing status that the update is in reply to.
- lat float (optional)
- The location's latitude that this tweet refers to.
- long float (optional)
- The location's longitude that this tweet refers to.
- placeId string (optional)
- A place in the world. These IDs can be retrieved from geo/reverse_geocode.
- displayCoordinates bool (optional)
- Whether or not to put a pin on the exact coordinates a tweet has been sent from.
Return
array
statusesDestroy
Destroys the status specified by the required ID parameter.
Usage note: The authenticating user must be the author of the specified status.
Parameters
- id string
- The numerical ID of the desired status.
Return
bool
statusesRetweet
Retweets a tweet. Returns the original tweet with retweet details embedded.
Parameters
- id string
- The numerical ID of the desired status.
Return
array
statusesRetweets
Returns up to 100 of the first retweets of a given tweet.
Parameters
- id string
- The numerical ID of the desired status.
- count int (optional)
- Specifies the number of records to retrieve. May not be greater than 100.
Return
array
statusesIdRetweetedBy
Show user objects of up to 100 members who retweeted the status.
Parameters
- id string
- The numerical ID of the desired status.
- count int (optional)
- Specifies the number of records to retrieve. May not be greater than 200.
- page int (optional)
- Specifies the page of results to retrieve.
Return
array
statusesIdRetweetedByIds
Show user ids of up to 100 users who retweeted the status.
Parameters
- id string
- The numerical ID of the desired status.
- count int (optional)
- Specifies the number of records to retrieve. May not be greater than 200.
- page int (optional)
- Specifies the page of results to retrieve.
Return
array
usersShow
Returns extended information of a given user, specified by ID or screen name as per the required id parameter.
The author's most recent status will be returned inline.
Parameters
- id string (optional)
- Specifies the ID or screen name of the user for whom to return results for.
- userId string (optional)
- Specfies the ID of the user for whom to return results for. Helpful for disambiguating when a valid user ID is also a valid screen name.
- screenName string (optional)
- Specfies the screen name of the user for whom to return results for. Helpful for disambiguating when a valid screen name is also a user ID.
Return
array
usersLookup
Return up to 100 users worth of extended information, specified by either ID, screen name, or combination of the two.
The author's most recent status (if the authenticating user has permission) will be returned inline.
Parameters
- userIds mixed (optional)
- A comma separated list of user IDs, up to 100 in total.
- screenNames mixed (optional)
- A comma separated list of screen names, up to 100 in total.
Return
array
usersSearch
Run a search for users similar to the Find People button on Twitter.com; the same results returned by people search on Twitter.com will be returned by using this API.
Usage note: It is only possible to retrieve the first 1000 matches from this API.
Parameters
- q string
- The search query term.
- perPage int (optional)
- Specifies the number of results to retrieve.
- page int (optional)
- Specifies the page of results to retrieve.
Return
array
usersSuggestions
Access to Twitter's suggested user list. This returns the list of suggested user categories. The category can be used in the users/suggestions/category endpoint to get the users in that category.
Return
array
usersSuggestionsSlug
Access the users in a given category of the Twitter suggested user list.
It is recommended that end clients cache this data for no more than one hour.
Parameters
- slug string
- The short name of list or a category.
Return
array
statusesFriends
Returns a user's friends, each with current status inline. They are ordered by the order in which the user followed them, most recently followed first, 100 at a time.
(Please note that the result set isn't guaranteed to be 100 every time as suspended users will be filtered out.)
Use the cursor option to access older friends.
With no user specified, request defaults to the authenticated user's friends.
It's also possible to request another user's friends list via the id, screen_name or user_id parameter.
Parameters
- id string (optional)
- Specifies the ID or screen name of the user for whom to return results for.
- userId string (optional)
- Specfies the ID of the user for whom to return results for. Helpful for disambiguating when a valid user ID is also a valid screen name.
- screenName string (optional)
- Specfies the screen name of the user for whom to return results for. Helpful for disambiguating when a valid screen name is also a user ID.
- cursor int (optional)
- Breaks the results into pages. This is recommended for users who are following many users. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
Return
array
statusesFollowers
Returns the authenticating user's followers, each with current status inline. They are ordered by the order in which they followed the user, 100 at a time. (Please note that the result set isn't guaranteed to be 100 every time as suspended users will be filtered out.)
Use the cursor parameter to access earlier followers.
Parameters
- id string (optional)
- Specifies the ID or screen name of the user for whom to return results for.
- userId string (optional)
- Specfies the ID of the user for whom to return results for. Helpful for disambiguating when a valid user ID is also a valid screen name.
- screenName string (optional)
- Specfies the screen name of the user for whom to return results for. Helpful for disambiguating when a valid screen name is also a user ID.
- cursor int (optional)
- Breaks the results into pages. This is recommended for users who are following many users. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
Return
array
trends
Returns the top ten topics that are currently trending on Twitter.
The response includes the time of the request, the name of each trend, and the url to the Twitter Search results page for that topic.
Return
array
trendsCurrent
Returns the current top 10 trending topics on Twitter.
The response includes the time of the request, the name of each trending topic, and query used on Twitter Search results page for that topic.
Parameters
- exclude string (optional)
- Setting this equal to hashtags will remove all hashtags from the trends list.
Return
array
trendsDaily
Returns the top 20 trending topics for each hour in a given day.
Parameters
- exclude string (optional)
- Setting this equal to hashtags will remove all hashtags from the trends list.
- date string (optional)
- Permits specifying a start date for the report. The date should be formatted YYYY-MM-DD.
Return
array
trendsWeekly
Returns the top 30 trending topics for each day in a given week.
Parameters
- exclude string (optional)
- Setting this equal to hashtags will remove all hashtags from the trends list.
- date string (optional)
- Permits specifying a start date for the report. The date should be formatted YYYY-MM-DD.
Return
array
userListsCreate
Creates a new list for the authenticated user. Accounts are limited to 20 lists.
Parameters
- user string
- The user.
- name string
- The name of the list you are creating.
- mode string (optional)
- Whether your list is public or private. Values can be public or private. Lists are public by default if no mode is specified.
- description string (optional)
- The description of the list you are creating.
Return
array
userLists
List the lists of the specified user. Private lists will be included if the authenticated users is the same as the user who's lists are being returned.
Parameters
- user string
- The user.
- cursor string (optional)
- Breaks the results into pages. This is recommended for users who are following many users. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
Return
array
userListsId
Show the specified list. Private lists will only be shown if the authenticated user owns the specified list.
Parameters
- user string
- The user.
- id string
- The id of the list.
Return
array
userListsIdUpdate
Updates the specified list.
Parameters
- user string
- The user.
- id string
- The id of the list.
- name string (optional)
- The name of the list you are creating.
- mode string (optional)
- Whether your list is public or private. Values can be public or private. Lists are public by default if no mode is specified.
- description string (optional)
- The description of the list you are creating.
Return
array
userListsIdStatuses
Show tweet timeline for members of the specified list.
Parameters
- user string
- The user.
- id string
- The id of the list.
- sinceId string (optional)
- Returns results with an ID greater than (that is, more recent than) the specified ID.
- maxId string (optional)
- Returns results with an ID less than (that is, older than) or equal to the specified ID.
- count int (optional)
- Specifies the number of records to retrieve. May not be greater than 200.
- page int (optional)
- Specifies the page of results to retrieve.
Return
array
userListsMemberships
List the lists the specified user has been added to.
Parameters
- user string
- The user.
- cursor string (optional)
- Breaks the results into pages. This is recommended for users who are following many users. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
Return
array
userListsSubscriptions
List the lists the specified user follows.
Parameters
- user string
- The user.
- cursor string (optional)
- Breaks the results into pages. This is recommended for users who are following many users. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
Return
array
userListMembers
Returns the members of the specified list.
Parameters
- user string
- The user.
- id string
- The id of the list.
- cursor string (optional)
- Breaks the results into pages. This is recommended for users who are following many users. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
Return
array
userListMembersCreate
Add a member to a list. The authenticated user must own the list to be able to add members to it. Lists are limited to having 500 members.
Parameters
- user string
- The user.
- id string
- The id of the list.
- userId string
- The id or screen name of the user to add as a member of the list.
Return
array
userListMembersDelete
Removes the specified member from the list. The authenticated user must be the list's owner to remove members from the list.
Parameters
- user string
- The user.
- id string
- The id of the list.
- userId string
- Specfies the ID of the user for whom to return results for.
Return
mixed
userListMembersId
Check if a user is a member of the specified list.
Parameters
- user string
- The user.
- id string
- The id of the list.
- userId string
- Specfies the ID of the user for whom to return results for.
Return
mixed
userListSubscribers
Returns the subscribers of the specified list.
Parameters
- user string
- The user.
- id string
- The id of the list.
- cursor string (optional)
- Breaks the results into pages. This is recommended for users who are following many users. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
Return
array
userListSubscribersCreate
Make the authenticated user follow the specified list.
Parameters
- user string
- The user.
- id string
- The id of the list.
Return
array
userListSubscribersDelete
Unsubscribes the authenticated user form the specified list.
Parameters
- user string
- The user.
- id string
- The id of the list.
Return
array
userListSubscribersId
Check if the specified user is a subscriber of the specified list.
Parameters
- user string
- The user.
- id string
- The id of the list.
- userId string
- Specfies the ID of the user for whom to return results for.
Return
mixed
directMessages
Returns a list of the 20 most recent direct messages sent to the authenticating user.
Parameters
- sinceId string (optional)
- Returns results with an ID greater than (that is, more recent than) the specified ID.
- maxId string (optional)
- Returns results with an ID less than (that is, older than) or equal to the specified ID.
- count int (optional)
- Specifies the number of records to retrieve. May not be greater than 200.
- page int (optional)
- Specifies the page of results to retrieve.
Return
array
directMessagesSent
Returns a list of the 20 most recent direct messages sent by the authenticating user.
Parameters
- sinceId string (optional)
- Returns results with an ID greater than (that is, more recent than) the specified ID.
- maxId string (optional)
- Returns results with an ID less than (that is, older than) or equal to the specified ID.
- count int (optional)
- Specifies the number of records to retrieve. May not be greater than 200.
- page int (optional)
- Specifies the page of results to retrieve.
Return
array
directMessagesNew
Sends a new direct message to the specified user from the authenticating user.
Requires both the user and text parameters. Returns the sent message in the requested format when successful.
Parameters
- text string
- The text of your direct message. Be sure to URL encode as necessary, and keep it under 140 characters.
- id string (optional)
- Specifies the ID or screen name of the user for whom to return results for.
- userId string (optional)
- Specfies the screen name of the user for whom to return results for. Helpful for disambiguating when a valid screen name is also a user ID.
- screenName string (optional)
- Specfies the ID of the user for whom to return results for. Helpful for disambiguating when a valid user ID is also a valid screen name.
Return
array
directMessagesDestroy
Destroys the direct message specified in the required ID parameter. The authenticating user must be the recipient of the specified direct message.
Parameters
- id string
- The ID of the desired direct message.
Return
array
friendshipsCreate
Allows the authenticating users to follow the user specified in the ID parameter.
Returns the befriended user in the requested format when successful.
Returns a string describing the failure condition when unsuccessful.
Parameters
- id string (optional)
- Specifies the ID or screen name of the user for whom to return results for.
- userId string (optional)
- Specfies the screen name of the user for whom to return results for. Helpful for disambiguating when a valid screen name is also a user ID.
- screenName string (optional)
- Specfies the ID of the user for whom to return results for. Helpful for disambiguating when a valid user ID is also a valid screen name.
- follow bool (optional)
- Returns public statuses that reference the given set of users.
Return
mixed
friendshipsDestroy
Allows the authenticating users to unfollow the user specified in the ID parameter.
Returns the unfollowed user in the requested format when successful. Returns a string describing the failure condition when unsuccessful.
Parameters
- id string (optional)
- Specifies the ID or screen name of the user for whom to return results for.
- userId string (optional)
- Specfies the screen name of the user for whom to return results for. Helpful for disambiguating when a valid screen name is also a user ID.
- screenName string (optional)
- Specfies the ID of the user for whom to return results for. Helpful for disambiguating when a valid user ID is also a valid screen name.
Return
array
friendshipsExists
Tests for the existence of friendship between two users. Will return true if user_a follows user_b, otherwise will return false.
Parameters
- userA string
- The ID or screen_name of the subject user.
- userB string
- The ID or screen_name of the user to test for following.
Return
bool
friendshipsShow
Returns detailed information about the relationship between two users.
Parameters
- sourceId string (optional)
- The user_id of the subject user.
- sourceScreenName string (optional)
- The screen_name of the subject user.
- targetId string (optional)
- The screen_name of the subject user.
- targetScreenName string (optional)
- The screen_name of the target user.
Return
array
friendshipsIncoming
Returns an array of numeric IDs for every user who has a pending request to follow the authenticating user.
Parameters
- cursor string (optional)
- Breaks the results into pages. This is recommended for users who are following many users. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
Return
array
friendshipsOutgoing
Returns an array of numeric IDs for every protected user for whom the authenticating user has a pending follow request.
Parameters
- cursor string (optional)
- Breaks the results into pages. This is recommended for users who are following many users. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
Return
array
friendsIds
Returns an array of numeric IDs for every user the specified user is following.
Parameters
- id string (optional)
- Specifies the ID or screen name of the user for whom to return results for.
- userId string (optional)
- Specfies the screen name of the user for whom to return results for. Helpful for disambiguating when a valid screen name is also a user ID.
- screenName string (optional)
- Specfies the ID of the user for whom to return results for. Helpful for disambiguating when a valid user ID is also a valid screen name.
- cursor string (optional)
- Breaks the results into pages. This is recommended for users who are following many users. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
Return
array
followersIds
Returns an array of numeric IDs for every user following the specified user.
Parameters
- id string (optional)
- Specifies the ID or screen name of the user for whom to return results for.
- userId string (optional)
- Specfies the screen name of the user for whom to return results for. Helpful for disambiguating when a valid screen name is also a user ID.
- screenName string (optional)
- Specfies the ID of the user for whom to return results for. Helpful for disambiguating when a valid user ID is also a valid screen name.
- cursor string (optional)
- Breaks the results into pages. This is recommended for users who are following many users. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
Return
array
accountVerifyCredentials
Returns an HTTP 200 OK response code and a representation of the requesting user if authentication was successful; returns a 401 status code and an error message if not. Use this method to test if supplied user credentials are valid.
Return
array
accountRateLimitStatus
Return
array
accountEndSession
Ends the session of the authenticating user, returning a null cookie. Use this method to sign users out of client-facing applications like widgets.
Return
bool
accountUpdateDeliveryDevices
Sets which device Twitter delivers updates to for the authenticating user. Sending none as the device parameter will disable IM or SMS updates.
Parameters
- device string
- Delivery device type to send updates to.
Return
array
accountUpdateProfileColors
Sets one or more hex values that control the color scheme of the authenticating user's profile page on twitter.com.
Each parameter's value must be a valid hexidecimal value, and may be either three or six characters (ex: #fff or #ffffff).
Parameters
- profileBackgroundColor string (optional)
- Profile background color.
- profileTextColor string (optional)
- Profile text color.
- profileLinkColor string (optional)
- Profile link color.
- profileSidebarFillColor string (optional)
- Profile sidebar's background color.
- profileSidebarBorderColor string (optional)
- Profile sidebar's border color.
Return
array
accountUpdateProfileImage
Updates the authenticating user's profile image.
Parameters
- image string
- The path to the avatar image for the profile. Must be a valid GIF, JPG, or PNG image of less than 700 kilobytes in size. Images with width larger than 500 pixels will be scaled down.
Return
array
accountUpdateProfileBackgroundImage
Updates the authenticating user's profile background image.
Parameters
- image string
- The path to the background image for the profile. Must be a valid GIF, JPG, or PNG image of less than 800 kilobytes in size. Images with width larger than 2048 pixels will be forceably scaled down.
- tile bool
- Whether or not to tile the background image. If set to true the background image will be displayed tiled. The image will not be tiled otherwise.
Return
array
accountUpdateProfile
Sets values that users are able to set under the "Account" tab of their settings page. Only the parameters specified will be updated.
Parameters
- name string (optional)
- Full name associated with the profile. Maximum of 20 characters.
- url string (optional)
- URL associated with the profile. Will be prepended with "http://" if not present. Maximum of 100 characters.
- location string (optional)
- The city or country describing where the user of the account is located. The contents are not normalized or geocoded in any way. Maximum of 30 characters.
- description string (optional)
- A description of the user owning the account. Maximum of 160 characters.
Return
array
favorites
Returns the 20 most recent favorite statuses for the authenticating user or user specified by the ID parameter in the requested format.
Parameters
- id string (optional)
- Specifies the ID or screen name of the user for whom to return results for.
- page int (optional)
- Specifies the page of results to retrieve.
Return
array
favoritesCreate
Favorites the status specified in the ID parameter as the authenticating user. Returns the favorite status when successful.
Parameters
- id string
- The numerical ID of the desired status.
Return
array
favoritesDestroy
Un-favorites the status specified in the ID parameter as the authenticating user. Returns the un-favorited status in the requested format when successful.
Parameters
- id string
- The numerical ID of the desired status.
Return
array
notificationsFollow
Enables device notifications for updates from the specified user. Returns the specified user when successful.
Parameters
- id string (optional)
- Specifies the ID or screen name of the user for whom to return results for.
- userId string (optional)
- Specfies the screen name of the user for whom to return results for. Helpful for disambiguating when a valid screen name is also a user ID.
- screenName string (optional)
- Specfies the ID of the user for whom to return results for. Helpful for disambiguating when a valid user ID is also a valid screen name.
Return
array
notificationsLeave
Disables notifications for updates from the specified user to the authenticating user. Returns the specified user when successful.
Parameters
- id string (optional)
- Specifies the ID or screen name of the user for whom to return results for.
- userId string (optional)
- Specfies the screen name of the user for whom to return results for. Helpful for disambiguating when a valid screen name is also a user ID.
- screenName string (optional)
- Specfies the ID of the user for whom to return results for. Helpful for disambiguating when a valid user ID is also a valid screen name.
Return
array
blocksCreate
Blocks the user specified in the ID parameter as the authenticating user. Destroys a friendship to the blocked user if it exists. Returns the blocked user in the requested format when successful.
Parameters
- id string (optional)
- Specifies the ID or screen name of the user for whom to return results for.
- userId string (optional)
- Specfies the screen name of the user for whom to return results for. Helpful for disambiguating when a valid screen name is also a user ID.
- screenName string (optional)
- Specfies the ID of the user for whom to return results for. Helpful for disambiguating when a valid user ID is also a valid screen name.
Return
array
blocksDestroy
Un-blocks the user specified in the ID parameter for the authenticating user. Returns the un-blocked user in the requested format when successful.
Parameters
- id string (optional)
- Specifies the ID or screen name of the user for whom to return results for.
- userId string (optional)
- Specfies the screen name of the user for whom to return results for. Helpful for disambiguating when a valid screen name is also a user ID.
- screenName string (optional)
- Specfies the ID of the user for whom to return results for. Helpful for disambiguating when a valid user ID is also a valid screen name.
Return
array
blocksExists
Un-blocks the user specified in the ID parameter for the authenticating user. Returns the un-blocked user in the requested format when successful.
Parameters
- id string (optional)
- Specifies the ID or screen name of the user for whom to return results for.
- userId string (optional)
- Specfies the screen name of the user for whom to return results for. Helpful for disambiguating when a valid screen name is also a user ID.
- screenName string (optional)
- Specfies the ID of the user for whom to return results for. Helpful for disambiguating when a valid user ID is also a valid screen name.
Return
mixed
blocksBlocking
Returns an array of user objects that the authenticating user is blocking.
Parameters
- page int (optional)
- Specifies the page of results to retrieve. Note: there are pagination limits. See the FAQ for details.
Return
array
blocksBlockingIds
Returns an array of numeric user ids the authenticating user is blocking.
Return
array
reportSpam
The user specified in the id is blocked by the authenticated user and reported as a spammer.
Parameters
- id string (optional)
- Specifies the ID or screen name of the user for whom to return results for.
- userId string (optional)
- Specfies the screen name of the user for whom to return results for. Helpful for disambiguating when a valid screen name is also a user ID.
- screenName string (optional)
- Specfies the ID of the user for whom to return results for. Helpful for disambiguating when a valid user ID is also a valid screen name.
Return
array
savedSearches
Returns the authenticated user's saved search queries.
Return
array
savedSearchesShow
Retrieve the data for a saved search owned by the authenticating user specified by the given id.
Parameters
- id string
- The ID of the desired saved search.
Return
array
savedSearchesCreate
Creates a saved search for the authenticated user.
Parameters
- query string
- The query of the search the user would like to save.
Return
array
savedSearchesDestroy
Destroys a saved search for the authenticated user. The search specified by id must be owned by the authenticating user.
REMARK: This method seems not to work @later
Parameters
- id string
- The ID of the desired saved search.
Return
array
oAuthRequestToken
Allows a Consumer application to obtain an OAuth Request Token to request user authorization.
This method fulfills Secion 6.1 of the OAuth 1.0 authentication flow.
Parameters
- callbackURL string
Return
array An array containg the token and the secret
oAuthAccessToken
Allows a Consumer application to exchange the OAuth Request Token for an OAuth Access Token.
This method fulfills Secion 6.3 of the OAuth 1.0 authentication flow.
Parameters
- token string
- verifier string
Return
array
oAuthAuthorize
Will redirect to the page to authorize the applicatione
Return
void
oAuthAuthenticate
Allows a Consumer application to use an OAuth request_token to request user authorization. This method is a replacement fulfills Secion 6.2 of the OAuth 1.0 authentication flow for applications using the Sign in with Twitter authentication flow. The method will use the currently logged in user as the account to for access authorization unless the force_login parameter is set to true
REMARK: This method seems not to work @later
Return
void
trendsAvailable
Returns the locations that Twitter has trending topic information for.
The response is an array of "locations" that encode the location's WOEID (a Yahoo! Where On Earth ID) and some other human-readable information such as a canonical name and country the location belongs in.
The WOEID that is returned in the location object is to be used when querying for a specific trend.
Parameters
- lat float (optional)
- If passed in conjunction with long, then the available trend locations will be sorted by distance to the lat and long passed in. The sort is nearest to furthest.
- long float (optional)
- If passed in conjunction with lat, then the available trend locations will be sorted by distance to the lat and long passed in. The sort is nearest to furthest.
Return
array
trendsLocation
Returns the top 10 trending topics for a specific location Twitter has trending topic information for.
The response is an array of "trend" objects that encode the name of the trending topic, the query parameter that can be used to search for the topic on Search, and the direct URL that can be issued against Search.
This information is cached for five minutes, and therefore users are discouraged from querying these endpoints faster than once every five minutes. Global trends information is also available from this API by using a WOEID of 1.
REMARK: This method seems not to work @later
Parameters
- woeid string
- The WOEID of the location to be querying for.
Return
array
geoReverseGeoCode
Search for places (cities and neighborhoods) that can be attached to a statuses/update. Given a latitude and a longitude, return a list of all the valid places that can be used as a place_id when updating a status.
Conceptually, a query can be made from the user's location, retrieve a list of places, have the user validate the location he or she is at, and then send the ID of this location up with a call to statuses/update.
There are multiple granularities of places that can be returned -- "neighborhoods", "cities", etc. At this time, only United States data is available through this method.
This API call is meant to be an informative call and will deliver generalized results about geography.
Parameters
- lat float
- The location's latitude that this tweet refers to.
- long float
- The location's longitude that this tweet refers to.
- accuracy string (optional)
- A hint on the "region" in which to search. If a number, then this is a radius in meters, but it can also take a string that is suffixed with ft to specify feet. If this is not passed in, then it is assumed to be 0m. If coming from a device, in practice, this value is whatever accuracy the device has measuring its location (whether it be coming from a GPS, WiFi triangulation, etc.).
- granularity string (optional)
- The minimal granularity of data to return. If this is not passed in, then neighborhood is assumed. city can also be passed.
- maxResults int (optional)
- A hint as to the number of results to return. This does not guarantee that the number of results returned will equal max_results, but instead informs how many "nearby" results to return. Ideally, only pass in the number of places you intend to display to the user here.
Return
array
geoId
Find out more details of a place that was returned from the geo/reverse_geocode method.
Parameters
- id string
- placeId string (optional)
- A place in the world. These IDs can be retrieved from geo/reverse_geocode.
Return
array
helpTest
Test
REMARK: this methods seems not to work, so don't rely on it
Return
bool