Not just Actionscript noodlings


22 Apr

TwitterScript proxy problem


I used TwitterScript for a project recently to display the site’s twitter posts and ran into Twitter’s cross domain policy. Basically you can’t access XML direct from Twitter.

Actionscripter talks about the problem, not specifically about TwitterScript, and gives a php solution:

The following two lines of PHP code will create your proxy service. Name this proxy.php and put it on your server:

<?php
$url = $_GET['url'];
readfile($url);
?>

Now, instead of calling

http://twitter.com/statuses/user_timeline/zenbullets.xml?count=5

We call

http://yourserver.com/proxy.php?url=http://twitter.com/statuses/
        user_timeline/zenbullets.xml?count=5

Th problem with TwitterScript is that (at the time of writing) it is released as a swc, which doesn’t allow you to edit the code. My solution was to manually download the actionscript files from http://code.google.com/p/twitterscript/source/browse/#svn/trunk/src/com/twitter/api and build my own repository, using this instead of the swc. Then inside Twitter.as replace as instructed above.


1 Response Filed under: actionscript 3