Results 1 to 3 of 3

Thread: getFeed Question

  1. #1

    Thread Starter
    Hyperactive Member Olly79's Avatar
    Join Date
    May 2005
    Posts
    264

    getFeed Question

    Hi all,

    I'm retrieving an XML feed via php:

    PHP Code:
    <?php 
       header
    ('Content-type: text/xml');
       echo 
    file_get_contents('http://www.somexmlfeed.com/feed.xml');
    ?>
    Now this is working fine and I'm able to work with the XML data to populate my website - this data is only updated when the page is refreshed; therefore I wondered if there was a way I could send out this request every couple of seconds without a page refresh?

    Any help much appreciated as I'm struggling with this.

  2. #2
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: getFeed Question

    Without a page refresh? I guess the only way would be with javascript/ajax. Or you can automate the refresh by using something like:

    PHP Code:
    header'refresh: 5; url=page.php' ); 


    Has someone helped you? Then you can Rate their helpful post.

  3. #3
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: getFeed Question

    my initial assumption is that you wanted to update this feed data whether or not your site is actually visited or not. you can make a script that updates it and add it as a scheduled task (windows) or a cron job (unix). to run every minute, or something. running every few seconds would be a little pointless.

    but if you actually wanted real time updates on your website, there isn't really any way to efficiently do it that I know of. facebook does something a little like this, but I'm not sure to what extent. if I leave my browser open and come back a few hours later, my "friend feed" will be updated with a link that tells me "X new posts" were posted since my last refresh, which I can then click on and it will run ajax to update the feed. so, yeah, it's probably possible to do real time updates, as well! but, I've not looked into how they do it either.

    most sites just put things like that in an iframe, and have it refresh every 10-20 seconds.

Posting Permissions

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



Click Here to Expand Forum to Full Width