-
how to work with twitter if the xml feed is deprecated?
Hi,
some time ago I downloaded and modified this code so that my most recent tweet could be displayed in flash:http://www.republicofcode.com/tutori...witter_widget/
However, it seems like http://twitter.com/statuses/user_tim...=my_screenName no longer contains any data---XML or otherwise.
How is this accomplished now? Do you have to use oAuth or a proxy.php file? I couldn't get the latter to function or find a good tutorial on the former.
Any help would be greatly appreciated.
Thanks,
---Yvette
-
Hi,
I figured out how to get the feed from here:http://api.twitter.com/1/statuses/us...=myusername-by altering the code from http://www.republicofcode.com/tutori...r_widget/2.php to this:
Code:
function processXML(e:Event):void {
var myXML:XML=new XML(e.target.data);
trace(myXML.channel.item[0].title);
if (oldTweet!=(myXML.channel.item[0].title)) {
containerTweets.ctext.tweet_1.text=myXML.channel.item[0].title;
oldTweet=myXML.channel.item[0].title;
trace(oldTweet,"oldTweet");
tweet();
}
However, it only works locally--There is a commented out line in the original code:
Code:
myXMLLoader.load(new URLRequest("proxy.php"));
which I removed the commenting from and commented out the following line:
Code:
//myXMLLoader.load(new URLRequest("http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=myusername"));
but, the proxy.php file which looks like this:
<?php
echo file_get_contents("http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=myusername");
?>
isnt returning the XML---I have a crossdomain.xml file too, which looks like this:
<?xml version="1.0" encoding="windows-1252"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="mysite.com" />
<allow-access-from domain="www.twitter.com" />
<allow-access-from domain="twitter.com" />
</cross-domain-policy>
but that doesnt help.
any suggestions?
Thanks,
---Yvette
-
Hi,
I figured out how to get the feed from here:http://api.twitter.com/1/statuses/us...=myusername-by altering the code from http://www.republicofcode.com/tutori...r_widget/2.php to this:
Code:
function processXML(e:Event):void {
var myXML:XML=new XML(e.target.data);
trace(myXML.channel.item[0].title);
if (oldTweet!=(myXML.channel.item[0].title)) {
containerTweets.ctext.tweet_1.text=myXML.channel.item[0].title;
oldTweet=myXML.channel.item[0].title;
trace(oldTweet,"oldTweet");
tweet();
}
However, it only works locally--There is a commented out line in the original code:
Code:
myXMLLoader.load(new URLRequest("proxy.php"));
which I removed the commenting from and commented out the following line:
Code:
//myXMLLoader.load(new URLRequest("http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=myusername"));
but, the proxy.php file which looks like this:
<?php
echo file_get_contents("http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=myusername");
?>
isnt returning the XML---I have a crossdomain.xml file too, which looks like this:
<?xml version="1.0" encoding="windows-1252"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="mysite.com" />
<allow-access-from domain="www.twitter.com" />
<allow-access-from domain="twitter.com" />
</cross-domain-policy>
but that doesnt help.
any suggestions?
Thanks,
---Yvette
-
Need some help
Hi,
I figured out how to get the feed from here:http://api.twitter.com/1/statuses/us...=myusername-by altering the code from http://www.republicofcode.com/tutori...r_widget/2.php to this:
Code:
function processXML(e:Event):void {
var myXML:XML=new XML(e.target.data);
trace(myXML.channel.item[0].title);
if (oldTweet!=(myXML.channel.item[0].title)) {
containerTweets.ctext.tweet_1.text=myXML.channel.item[0].title;
oldTweet=myXML.channel.item[0].title;
trace(oldTweet,"oldTweet");
tweet();
}
However, it only works locally--There is a commented out line in the original code:
Code:
myXMLLoader.load(new URLRequest("proxy.php"));
which I removed the commenting from and commented out the following line:
Code:
//myXMLLoader.load(new URLRequest("http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=myusername"));
but, the proxy.php file which looks like this:
PHP Code:
<?php
echo file_get_contents("http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=myusername");
?>
isnt returning the XML---I have a crossdomain.xml file too, which looks like this:
Code:
<?xml version="1.0" encoding="windows-1252"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="mysite.com" />
<allow-access-from domain="www.twitter.com" />
<allow-access-from domain="twitter.com" />
</cross-domain-policy>
but that doesnt help.
any suggestions?
Thanks,
---Yvette
-
Need some more help
ok-I went back to the tutorial at http://www.republicofcode.com/tutori...r_widget/3.php and made a twitter.php file as instructed:
PHP Code:
<?php
/*
* @return string
* @param string $url
* @desc Return string content from a remote file
* @author Luiz Miguel Axcar (lmaxcar@yahoo.com.br)
*/
function get_content($url)
{
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_HEADER, 0);
ob_start();
curl_exec ($ch);
curl_close ($ch);
$string = ob_get_contents();
ob_end_clean();
return $string;
}
#usage:
$content = get_content ("http://twitter.com/statuses/user_timeline.xml?screen_name=myusername");
echo $content;
?>
Still doesnt work.
If I go to the twitter.php on my site--http://mysite/twitter.php-
it returns this:
/statuses/user_timeline.xml?screen_name=myname Rate limit exceeded. Clients may not make more than 150 requests per hour
help?
Thanks,
---Yvette
-
Its working now---
---Yvette
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|