rss & Flash

Out of context: Reply #3

  • Started
  • Last post
  • 4 Responses
  • noiseisthis0

    yea. you cant get the feed directly due to twitter's cross domain policy.
    http://twitter.com/crossdomain.x….

    you can use this php script and create a cron job to run the script to retrieve and write the file to your server.

    <?php
    //--- load in the xml ---
    $theRAW = file_get_contents("http://twitter.com/statuses/user_timeline.xml?screen_name=<your user name here>");
    $theXML = simplexml_load_string($theRAW);

    //--- load in xml file to edit. if doesnt exist, create ---
    $xmlFile = "yourfilename.xml";
    $xmlHandle = fopen($xmlFile, "w");

    //--- set xml as string to be written ---
    $xmlString = $theXML->asXML();
    echo($xmlString);

    //--- write xml to file ---
    fwrite($xmlHandle, $xmlString);

    //--- close out xml file ---
    fclose($xmlHandle);
    ?>

    and make the cron job run in intervals of 15min+. sometimes the php script will get the fail whale so create another cron job that uses the same script but name the xmlfile a diff file name. then in flash use a conditional:
    if(xmlFile == "" || xmlFile == " ")
    {
    (use backup xmlFile)
    }

    $5 thank you :)

View thread