Twitter API Library – Build 5
URI: http://sandbox.gtaero.net/twitter_api/code.php?b=5 (Preview Level Code)
Change Log:
- Added string $twitter->get_sn_from_id(int $uid)
- Added string $twitter->get_name_from_id(int $uid)
- Added string $tw->profile_pic( [ int $uid = NULL [, array $options = NULL ] ] )
Options:- bool linked = true – Link to the User’s Profile
- string size = thumb (of small, thumb, large, or full) – Base Size of the Image
- int height = Size’s Default – Height in Pixels
- int width = Size’s Default – Width in Pixels
Known Issues:
- No Support for Unauthenticated Requests.
- $tw->name() does not support users other than the currently logged in user.
- $tw->profile_pic() does not support users other than the currently logged in user.
- $twitter->get_sn_from_id() does not support users other than the currently logged in user.
- $twitter->get_name_from_id() does not support users other than the currently logged in user.
Twitter API Library – Build 4
I’m going to post status updates on the Twitter API Library, despite the fact that I don’t think anyone is using it yet. I’ll post Change Logs to the blog.
URI: http://sandbox.gtaero.net/twitter_api/code.php?b=4 (Preview level Code)
- Addition of Read-Only “Quick Variables” for easy access.
- $twitter->uid – Logged In User’s ID.
- $twitter->name – Logged In User’s Full Name.
- $twitter->screen_name – Logged In User’s Screen Name.
- $twitter->first_name – Logged In User’s First Name (generated).
- $twitter->last_name – Logged In User’s Last Name (generated).
- Changes to $twitter->require_login() process (happens once per session):
- $twitter->require_login() is called.
- OAuth Data is Gathered from Twitter’s Server.
- User is Redirected to Twitter OAuth Authorization Page.
- OAuth Redirects User to Call Back Page (which should include or BE Twitter.php)
- Twitter API Library automatically redirects to page that called require_login() with OAuth Token
- $twitter->require_login() is called.
- OAuth Authorized Tokens are Stored and page is refreshed automatically without the OAuth Token in the URI.
- Authorization Tokens can then be called for storage using
list($token_key,$token_secret) = $twitter->get_login(). - If Authorization Tokens have been stored, entire process can be skipped using $twitter->use_login($token_key,$token_secret);
- Authorization Tokens can then be called for storage using
- $twitter->api->account_verifyCredentials() is called and the result is cached.
- Quick Variables are created.
- First Preview of “TWML” or Twitter Markup Language.
- TWML should be called with $tw = new TWML($twitter);
- Created Tag: $tw->name([ int $uid = NULL [, array $options ] ] )
Supported Options:- linked = true (link to profile)
- useyou = true (display “you” instead of name if logged in user)
- firstnameonly = false (only display first name)
- lastnameonly = false (only display last name (if available, else first))
- screennameonly = false (only display screen name)
- possessive = false (use possessive case, e.g. “your”)
- reflexive = false (use reflexive case, e.g. “yourself”)
- capitalize = false (capitalize if not a name, e.g. “Your”)
- subjectid = NULL
- Added $twitter->api->call_amount() which returns the amount of requests made to twitter (this instance).
Known Issues:
- No Support for Unauthenticated Requests
- $tw->name() does not support users other than the currently logged in user.
Twitter PHP Library
Well, being a PHP developer I quickly got excessively tired of looking for the proper Twitter Library with all the features that returned good results, and I got tired of looking for proper libraries and classes that could interface with OAuth.
Then, I found a relatively new (albeit “Beta”) Twitter OAuth Library, but it still required more steps than I really wanted to do just to get user authentication in a program. So I decided to finally piece everything together and write Twitter API Library.
This library basically does everything you would expect it to do, except for Unauthenticated Requests and the Search API… I haven’t gotten around to coding that in yet, as it was not the primary focus of this library.
The library is not thoroughly tested, but theoretically shouldn’t encounter any errors. I would be very grateful to anyone who’ll test it for me. (I can’t work out the bugs without testers, so please, test!).