Navarr's Tech Side The Technical Side of my Life

13Nov/090

Twitter API Library 0.2 in Near Future

Some of the current issues with the Twitter API Library seem to be with the Twitter OAuth library we’re using courtesy of Abraham Williams.  I looked into simply updating the code to the newer version of TwitterOAuth, but it seems that are multiple incompatibilities that prevent us from doing so, requiring a rewrite of some of the automated authentication code.  As much of a bad thing that this is, it is a good thing as well, and hopefully the newer version of our library will add some much desired features.

Until then, v0.1 will still work for most things.

9Nov/090

Twitter API Library – Build 8

I’d like to introduce Build 8 to the masses.  Sorry for the long delay in posting, but I was working on a new Twitter Client, TwCLI (which uses the Twitter API Library and is Open Source).

Build 8 contains unsupported support for Twitter Lists.  Basically, we have built Twitter lists into the library, but a large number of functions are not working for what seems to be an incompatibility between our OAuth Libraries and Twitter.

Change Log:

  • Added array api->lists_update( string $old_name, string $new_name = null, string $privacy = null) [Working]
  • Added array api->lists_get( string $screen_name = null, int $cursor = null)
    $screen_name defaults to the logged in user if set as null. [Working]
  • Added array api->lists_display( string $screen_name, string $list_slug) [Unverified]
  • Added array api->lists_statuses( string $screen_name, string $list_slug, int $since_id = null, int $max_id = null, int $count = null, int $page = null) [Working]
  • Added array api->lists_memberships( string $screen_name, string $list_slug, int $cursor = null) [Unverified]
  • Added array api->lists_subscriptions( string $screen_name = null )
    $screen_name defaults to the logged in user if set as null. [Unverified]
  • Added array api->lists_destroy( string $list_slug ) [Not Working]
  • Added array api->list_members( string $screen_name, string $list_slug, int $cursor = null ) [Unverified]
  • Added array api->list_membersAdd( string $list_slug, int $user_id ) [Working]
  • Added array api->list_membersDelete( string $list_slug, int $user_id ) [Unverified]
  • Added array api->list_isMember( string $screen_name, string $list_slug, string $screen_name_to_check ) [Unverified]
  • Added array api->list_subscribers( string $screen_name, string $list_slug, int $cursor = null) [Unverified]
  • Added array api->list_subscribe( string $screen_name, string $list_slug ) [Unverified]
  • Added array api->list_unsubscribe( string $screen_name, string $list_slug ) [Unverified]
  • Added array api->isSubscriber( string $screen_name, string $list_slug, string $screen_name_to_check ) [Unverified]

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.
  • Two instances of Twitter API Library can not co-exist on the same sub-domain.
  • $twitter->api->lists_destroy() is returning “Incorrect Signature.”
6Nov/090

Twitter API Library – Build 7

Well, this is going to break some things if you’re using an older build.  Primarily any method that required the ID/Screen Name/User ID of a user.  I thought I had pushed out this change before the Build 4 release, but apparently it was still on my computer.

Now, any API methods that were function( mixed $id = NULL, string $screen_name = NULL, int $user_id = NULL ) are now: function( mixed $id, int $id_type = TWITTER_ID ). $id_type can be one of “TWITTER_ID” (lets twitter decide if you’re using a screen name or user id), “TWITTER_SN” (tells twitter you’re using a screen name) or “TWITTER_UID” (tells twitter you’re using a user ID).  This parameter may be omitted and will default to TWITTER_ID.

URI: http://sandbox.gtaero.net/twitter_api/code.php?b=7

Change Log:

  • Changed Tri-optional User Identification procedure in the API methods to Two Parameters $id and $id_type.
  • Added array api->lists_create( string $name [, int $privacy = TWITTER_PRIVACY_PUBLIC ] )
  • $privacy may be one of TWITTER_PRIVACY_PUBLIC or TWITTER_PRIVACY_PRIVATE

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.
  • Two instances of Twitter API Library can not co-exist on the same sub-domain. (All Versions)
6Nov/090

Twitter API Library – Build 6

Decided to push out one last, though much smaller, build tonight – Build 6.  Build 6 moves from Authorize to Authenticate and adds a TWML function.  There are some other small changes in Build 6 from the other builds, but these are not documented yet, and will probably require the help of someone who knows more about OAuth than I to become supported (yes, I’m talking about setup_login() and set_cache_dir()).

URI: http://sandbox.gtaero.net/twitter_api/code.php?b=6

Change Log:

  • Moved from using OAuth Authorize to OAuth Authenticate.  Users will no longer have to continually click “Allow this application.”  Now they just do it once and Twitter API Library will auto-magically log them in next time.
  • Added bool $tw->if_is_user( int $user_id ) which returns true if the current user is the same as the inserted ID, and false if they aren’t.

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.
5Nov/092

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.
5Nov/090

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):
    1. $twitter->require_login() is called.
    2. OAuth Data is Gathered from Twitter’s Server.
    3. User is Redirected to Twitter OAuth Authorization Page.
    4. OAuth Redirects User to Call Back Page (which should include or BE Twitter.php)
    5. Twitter API Library automatically redirects to page that called require_login() with OAuth Token
    6. $twitter->require_login() is called.
    7. 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);
    8. $twitter->api->account_verifyCredentials() is called and the result is cached.
    9. 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.
3Nov/090

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!).

1Nov/090

It’s Facebook’s Turn to Scratch OUR Back

imageQuite possibly one of the largest and most influential things pulling users to Facebook has always been the application platform.  It’s simple, it’s intuitive, and developers are doing everything they can to make money off the platform, including advertisements and resorting to sleazy scams like Offerpal and SuperRewards, all the while paying Facebook more and more money for advertising that, most of the time appears on other application’s sidebar.

Why has it taken us Developers this long to realize it?  Facebook is making a profit off of our applications and giving us absolutely nothing in return.  Not only are developers paying Facebook to get more users, but we’re giving them free advertising space and revenue.  It’s obviously time that Facebook started scratching the developer’s back by giving them some of the revenue off the advertisements that appear on their own application pages!  This would offer application developers a clean, non-scammy, non-shoddy revenue stream with advertisements that would always fit with the Facebook platform policy, without even disrupting the feel of the application.

Facebook is constantly complaining about the scammy and shoddy methods developers implement to try to make their application more viral to manage some form of income, but if Facebook just paid developers a percentage for the advertisements being placed on those same developer’s applications, than the entire Facebook experience would be cleaner and much more appealing to the end user.

Why hasn’t anyone thought of this before?