2

I want to show yahoo news feeds in my website, so I need to read Yahoo rss.

How to request it, with javascript? Do "Access-Control-Allow-Origin" let it go?

3
  • What else do you have ? Any code ? Commented Sep 3, 2013 at 18:43
  • @Milche Patern. I tried with $.ajax() simple page,but I blocked by Access-Control-Allow-Origin. so i think it may be happened for xml too Commented Sep 3, 2013 at 18:51
  • 1
    You can use EasyXDM easyxdm.net/wp Commented Sep 3, 2013 at 18:56

1 Answer 1

1

XML won't run cross-site like that. You could convert it to json using something like Yahoo Pipes.

Using this pipe http://pipes.yahoo.com/pipes/pipe.info?_id=DJEg41Ac3BG8IAI2E5PZnA and configuring with url:http://news.yahoo.com/rss/ and path:channel.item

You can make json output by grabbing the "Get as JSON" link that gives you this url: http://pipes.yahoo.com/pipes/pipe.run?_id=DJEg41Ac3BG8IAI2E5PZnA&_render=json&path=channel.item&url=http%3A%2F%2Fnews.yahoo.com%2Frss%2F

And here's a jsfiddle using that pipe http://jsfiddle.net/5KM4X/

If you don't want to rely on Pipes, you could write a local server side script that does nothing by proxy the remote url and expose it's output. Using PHP, you could have a file called

getFeed.php

<?php
header('Content-type: application/xml');
echo file_get_contents("http://news.yahoo.com/rss");

And then access it (using jquery here)

 $.get('getFeed.php', function(xml){
 ....
Sign up to request clarification or add additional context in comments.

2 Comments

nice, Do pipe request has limit access (e.g 1000 per day or ...)?
Looks like it's 20 calls / minute with no daily limit but if you exceed you get blocked for an hour. Pipes FAQ

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.