polyGeek.com
polyGeek.com
polyGeek.com

Enable your Flex app to update Twitter via AMFPHP

October 6th, 2008 . by polygeek

Creating a Flex app to communicate with Twitter is surprisingly easy. So easy even a polyGeek can do it. :-)


pgTV

Watch a video tutorial for setting up a Flex app to sent Tweets via AMFPHP

[ Other AMFPHP video tutorials ]

view source
download source

I signed my RunPee.com site for a Twitter account: RunPee. I wanted the app to be able to send tweets whenever someone added or cloned a PeeTime. The application already uses AMFPHP for all it’s database communications so I was already half way there.

But for the purposes of this tutorial I’ll start a project from scratch.

If you’re testing locally you’ll of course need WAMP server running with AMFPHP and CURL enabled. CURL isn’t enabled in WAMP by default but it’s very easy to do so. On a Windows machine just follow these instructions:

  1. Shut down WAMP: Stop all services
  2. Open the folder: WAMP\bin\php\( your version of php )
  3. Open the file: php.ini
  4. Do a text search for: “extension=php_curl.dll” and remove the comment so that it’s enabled
  5. Open the folder: WAMP\bin\Apache\(your version of apache)\bin\
  6. Open the file: php.ini
  7. Do a text search for: “extension=php_curl.dll” and remove the comment so that this to is enabled
  8. Save/close both .ini files
  9. Restart All Services in WAMP

Now we need some php script that will hook us up with the Twitter API. I canabalized the code from this tutorial here at Woork. I then combined Woork’s code with the Twitter documentation to enable the functionality I needed. Actually, all I needed to do was send a tweet but as your can see the example below does much more. And that’s still not everything. But you should be able to extend what I’ve done here to take advantage off all the Twitter API that you need to.

Also, I signed up for a Twitter account for testing purposes that you can use. You don’t want to use your own because you’ll be spamming people as you test - like I accidentally did. :-)

Testing Twitter account: FlexAMFPHPtest / password ( yes, the password is password. )

In all my examples here I’m returning the data as XML but you can switch to JSON or RSS in many cases. I chose XML because you would be able to extract data from it using E4X - which I’ll leave as an exercise for the reader.

Share and Enjoy:
  • del.icio.us
  • Reddit
  • StumbleUpon
  • Technorati
  • Digg
  • Facebook
  • Slashdot

similar posts

One Response to “Enable your Flex app to update Twitter via AMFPHP”

  1. comment number 1 by: Sean

    Hi

    Thanks for the post. Enjoyed the honesty of your comments.

    Regards

   Welcome back (Change)

Leave a Reply

comment feed RSS  subscribe to this comment thread
Recent Posts

   




© Copyright 2008 polyGeek.com / Dan Florio, All Rights Reserved Except Where Explicitly Stated
Web Developement Blogs - Blog Catalog Blog Directory
Ajax CommentLuv Enabled 816cf46662e57ab1b89821d8e1e32a6b
M2 Websites