# To generate xml feed for Flash to read?

**URL:** <https://forum.kirupa.com/t/to-generate-xml-feed-for-flash-to-read/299135>\
**Category:** Uncategorized\
**Created:** [October 30, 2009, 11:08am UTC](https://forum.kirupa.com/t/to-generate-xml-feed-for-flash-to-read/299135 "2009-10-30T11:08:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tommiwalsh](https://avatars.discourse-cdn.com/v4/letter/t/dc4da7/32.png) [@tommiwalsh](https://forum.kirupa.com/u/tommiwalsh)\
**Post date:** [October 30, 2009, 11:08am UTC](https://forum.kirupa.com/t/to-generate-xml-feed-for-flash-to-read/299135/1 "2009-10-30T11:08:11Z")

</div>

Hi,

I’m working on a flash twitter feed which uses PHP to generate an xml file, which in turn the flash file reads. If I specify a twitter account then this all works fine, but I need it to randomly display one of three account feeds. Here’s where I’ve got to with the PHP to pick a random user-

```php

<?php

$twitArray = new
Array("username1.xml","username2.xml","username3.xml");

$randomName = $twitArray[rand(0,count($twitArray))];

$url = "http://twitter.com/statuses/user_timeline/" . $randomName;

$feedContent = file_get_contents($url);

if( $feedContent == "" )
{
    exit;
}
else
{
    $newfile="twitterRandom.xml";
    $file = fopen ($newfile, "w");
    fwrite($file, $feedContent);
    fclose ($file);
}

?>

```

I don’t really know anything about PHP so can’t see why it wouldn’t be working?

Any help would really be appreciated, and if anyone wants the AS and PHP for displaying a specific Twitter feed just ask and I’ll post it here as that’s working fine.

Thanks,

Tom
