<%@LANGUAGE="VBSCRIPT" %> <% Response.CacheControl = "no-cache" %>
Lab 11

Using the facebook, twitter, and bit.ly APIs

Instructions

You will create a simple application that will use facebook authentication to allow you to gain access to the app. After authenticating through facebook, you'll be able to enter a status update and a URL. The URL will be sent to bit.ly through the bit.ly API. The status and the shortened URL will be sent to twitter using the twitter API.

Materials you will create in this lab:

  • In your Lab11 folder
    • send2twitter.php
    • logout.php
    • includes folder
      • OAuth.php
      • twitteroauth.php

Procedures

  1. Make sure this URL works:
    http://cgtweb2.tech.purdue.edu/356/<yourFolder>/Lab11/send2twitter.php

  2. Download and use these include files.
     
  3. You will need to use your facebook account to authenticate yourself
     
  4. Create a bit.ly account
  5. Create a twitter account
    • After creating the account, search for rjglotzbach and follow me
      • I will then see your account and check it to see if your app works.

  6. Go to dev.twitter.com
    • Register a new app
    • Navigate to your cgtweb2 page in the browser, copy the URL out of the browser. Paste the URL into (a) Application Website and (b) Callback URL.
    • Give it an application name something like: CGT 356 bitly twit example app
    • Add a description
    • Put Purdue University in the organization box
    • Application type: browser
    • Access type: Read & Write
    • After completing the registration, find the following four api tokens:
      • Consumer Key
      • Consumer Secret
      • oauth_token
      • oauth_token_secret
    • Twitter libraries if you're interested: http://dev.twitter.com/pages/libraries
    • Twitter oauth help: http://dev.twitter.com/pages/auth
       
  7. Facebook app
    • Make sure that you are logged into facebook in the browser that you are using.
    • Go to: http://developers.facebook.com/setup/
    • Enter a site name - this is the name that will appear in facebook
    • Enter the URL... it must end with a / so only point to the Lab11 folder
    • On the page immediately after creating the app, copy that code and paste it into logout.php
    • You will need your App ID and App Secret
    • Additional help with the rest of the code can be found here:
      http://developers.facebook.com/docs/guides/web/
       
  8. logout.php
    • Slightly modify the code you pasted in to include these session statements
       
  9. send2twitter.php
    • The facebook code is taken directly from the developer site (listed above) with some minor modifications.
    • The bit.ly code is taken from the bit.ly developer site and modified to fit our example.
    • The twitter code is taken from the twitter api / dev site and modified to fit our example.
    • The rest has either been described above or is described within the code.
    • Here is the code to finish out this lab exercise.
       
  10. Finally
    • Send @rjglotzbach a message from your app letting me know that you've gotten your app working and I will come check it out and tweet you back.
       
  11. Make sure it works on the server!!!
     
  12. Save a backup copy to your personal drive space.
     
  13. Do not modify any files after the deadline. Timestamps on all files will be checked during grading.

Grading

Facebook Auth -5 max
Twitter API -5 max
Bit.ly API -5 max
Comments -5 max
Total 20 pts possible