Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Dec 2006
    Posts
    417
    Thanks
    168
    Thanked 1 Time in 1 Post

    long and complex PHP/JS/AJAX/RSS question

    how do I create a script that serves RSS headlines hosted on my server that users can cut and paste simple code to embed in their blogs/sites that outputs those RSS headlines?

    My Server: creates XML


    User Site: user cuts and pastes code into his/her site, something simple like:

    Code:
    <script type="text/javascript" src="http://www.server.com/code.php"></script>
    how can this be done?

  • #2
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,043
    Thanks
    19
    Thanked 42 Times in 42 Posts

  • #3
    Regular Coder
    Join Date
    Dec 2006
    Posts
    417
    Thanks
    168
    Thanked 1 Time in 1 Post
    no, I already know how to create an RSS feed.

    that is step 1 and that is the easy part.

    in fact, I will show you my basic example:
    http://www.gabbr.com/promotion/linkexchange/ssirss.php

    step 2 would be to create an AJAX .js file that parses the RSS feed and outputs it. here is step 2:

    http://www.gabbr.com/promotion/linkexchange/ssirss2.js

    step 3 would be to cut and paste that above .js file into an external site... this is where I am stuck. I am doing this but nothing is happening. No errors. Nothing. View source the following link:

    http://www.gabbr.com/drdel/test.php

    any help please?

  • #4
    Regular Coder
    Join Date
    Dec 2006
    Posts
    417
    Thanks
    168
    Thanked 1 Time in 1 Post
    i think the problem here is that i would be trying to do an AJAX request across domains -- this is impossible to do.

    so a proxy script must be setup.. but I am unsure how to do this.

    can someone help?

  • #5
    Regular Coder Skyzyx's Avatar
    Join Date
    Aug 2002
    Location
    Silicon Valley, CA
    Posts
    980
    Thanks
    0
    Thanked 0 Times in 0 Posts
    SimplePie Live! was designed exactly for this purpose... mostly. It is a web service that fetches and parses feeds on the server side using SimplePie, and it returns a JSON object that you can use in your pages. It'd be up to you to take the data and give it a display, but all-in-all, it takes care of it all.

    On the pro side, SimplePie Live! uses JSONP to bypass cross-domain issues (and is the same method that Google uses in most of their apps). This way, you can write simple JavaScript/DOM code and the feeds are fetched, parsed, cached, and converted to JSON on the server.

    On the con side, although the JSON data that SimplePie Live! returns will work in essentially ANY JavaScript-enabled web browser, Internet Explorer seems to have issues with the script I wrote to load the external JSON file.

    So, this solution will work with Firefox, Safari, and Opera, but I could definitely use some help in re-writing some of the JavaScript code for IE.

    Creator of SimplePie and Tarzan AWS, co-founder of WarpShare, co-built the Y! Messenger website, usability-focused, and an INFJ personality.


  •  

    Posting Permissions

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