script for grabbing an xml rss feed file into my server as xml file too

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ARGENTINA

    script for grabbing an xml rss feed file into my server as xml file too

    How do I copy using a php or cgi script a remote xml rss feed into my
    server?
    I.E the rss feed:

    LA NACION ofrece las últimas noticias, fotos y videos de la Argentina y el mundo. Política, economía, deportes y toda la información en tiempo real.


    Due to restrictions in flash player 7 I need to load a remote xml rss
    feed.
    I am using load.xml( http://www....

    but in that way doesn´t work

    The only way that works is when the rss xml feed is placed on my
    server. I could upload manually the xml rss feed but I need a php
    script to be called from flash and then parsed. What I need is the
    script to make that remote xml being "local" to my flash movie.

    Trying other stuff Ive found on forums about "proxy scripting" but
    that only works if you are using flash player 6, flash player 7 even
    don´t allow redirection scripts at all.

    Hope anybody could help

    Marcos
  • Tim Van Wassenhove

    #2
    Re: script for grabbing an xml rss feed file into my server as xml file too

    On 2004-12-28, ARGENTINA <sjprec@yahoo.c om> wrote:[color=blue]
    > The only way that works is when the rss xml feed is placed on my
    > server. I could upload manually the xml rss feed but I need a php
    > script to be called from flash and then parsed. What I need is the
    > script to make that remote xml being "local" to my flash movie.[/color]

    place something like this on your server

    <?php
    // gateway.php
    if (!isset($_GET['url'])) exit();
    echo file_get_conten ts($_GET['url']);
    ?>

    meaby you want to limit the allowed urls, throw in a default, add some
    caching... i think the concept is clear.


    --
    Met vriendelijke groeten,
    Tim Van Wassenhove <http://www.timvw.info>

    Comment

    • rchaplin

      #3
      Re: script for grabbing an xml rss feed file into my server as xml file too

      I use the following in my site for listing RSS Feeds to my homepage:
      <?php
      $rdffile = ($rdf_dir."slas hdot.rdf");
      $remote = "http://slashdot.org/slashdot.rdf";
      $refreshtime = time() - 3600;

      if ((filemtime($rd ffile) < $refreshtime) ||
      (filesize($rdff ile) == 0)) {
      $RDF = fopen( $rdffile, "w" ) or die(
      "Cannot open $rdffile" );
      $FILE = fopen( $remote, "r" ) or die(
      "Cannot open $remote" );
      while (!feof( $FILE )) {
      fwrite( $RDF, fgets( $FILE, 1024 ));
      }
      fclose( $RDF );
      fclose( $FILE );
      }

      ?>

      Of course, I use php to parse the feed, but this should help.
      Basically, it checks to see if there is a recent copy of the xml file,
      otherwise it updates it from the feedsite after 3600 seconds have
      passed. This prevent spamming of the feed site.

      Comment

      • sharma

        #4
        Re: script for grabbing an xml rss feed file into my server as xml file too

        Hi

        I hope this code suits your needs..



        subbu


        rchaplin wrote:[color=blue]
        > I use the following in my site for listing RSS Feeds to my homepage:
        > <?php
        > $rdffile = ($rdf_dir."slas hdot.rdf");
        > $remote = "http://slashdot.org/slashdot.rdf";
        > $refreshtime = time() - 3600;
        >
        > if ((filemtime($rd ffile) < $refreshtime) ||
        > (filesize($rdff ile) == 0)) {
        > $RDF = fopen( $rdffile, "w" ) or die(
        > "Cannot open $rdffile" );
        > $FILE = fopen( $remote, "r" ) or die(
        > "Cannot open $remote" );
        > while (!feof( $FILE )) {
        > fwrite( $RDF, fgets( $FILE, 1024 ));
        > }
        > fclose( $RDF );
        > fclose( $FILE );
        > }
        >
        > ?>
        >
        > Of course, I use php to parse the feed, but this should help.
        > Basically, it checks to see if there is a recent copy of the xml[/color]
        file,[color=blue]
        > otherwise it updates it from the feedsite after 3600 seconds have
        > passed. This prevent spamming of the feed site.[/color]

        Comment

        Working...