The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.


Results 1 to 5 of 5

Thread: to generate xml feed for Flash to read?

  1. #1

    to generate xml feed for Flash to read?

    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 Code:
    <?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

  2. #2

    It can be done via flash

    Hello tommiwalsh,

    It can be done via flash also load all the three (or whatevet number of account) in flash then select randomaly account, As per my knowledge it makes your work very easy.

    Regards,
    Kunjan.

  3. #3
    Hi Kunjan,

    Thanks for the quick response, at the moment I have this AS to link to the PHP-

    Code:
    loadVariablesNum("http://www.myurl.com/RandomUpdateXML.php", 0, "GET");
    
    function loadXML(loaded) {
        if (loaded) {
            _root.comments = this.firstChild.childNodes[0].childNodes[2].firstChild.nodeValue;
            twitter_txt.text = _root.comments;
        } else {
            content = "file not loaded!";
        }
    }
    xmlData = new XML();
    xmlData.ignoreWhite = true;
    xmlData.onLoad = loadXML;
    xmlData.load("http://www.myurl.com/twitterRandom.xml");
    and this was the PHP I was using for a single users tweets to display-

    PHP Code:
    <?php

    $feedContent 
    file_get_contents("http://twitter.com/statuses/user_timeline/username1.xml" );

    if( 
    $feedContent == "" ){
                    exit;
    }
    else
    {
        
    $newfile="twitterFeed.xml";
        
    $file fopen ($newfile"w");
        
    fwrite($file$feedContent);
        
    fclose ($file); 
    }
    ?>
    I'm quite new to all this sort of thing so would what I'm using already be quite easy to adapt for that or should I start from scratch with the AS to do that?

    Thanks again,

    Tom

  4. #4
    why not just do an array in flash, and then put the random name in the
    Code:
    xmlData.load("http://www.myurl.com/randomflasharrayvalue.xml");
    Let us live so that when we come to die even the undertaker will be sorry. - Mark Twain
    Don't PM me your CSS, xHTML, JS or PHP questions. I will not reply to ANY IE6 questions.

  5. #5
    Hi,

    As far as I know Twitter changed their permissions, so I need the PHP to refresh the xml with the new data. If there's a way to do it purely in Flash I'd prefer it, but so far this is the only way I've found? How would you do it within the array, would it be able to pull in the most recent tweets direct from Twitter?

    Thanks,

    Tom

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012