views:

47

answers:

1

Hi, I am working on News means I need to include online yahoo news title and description in my page. For that I have to create 1 batch file , but the problem is that how to create that batch file which will call the yahoo online news inside that file then how can I include that file in my page?

Thanks

+1  A: 

You can do that using javascript on the browser.

Look for a JSON feed in the Yahoo API, that delivers JSON with a callback function, ie:
http://search.yahooapis.com/.../news?results=20&output=json&callback=myCallBackFunction

Then in your page have a global function:

function myCallBackFunction(json){

  //show here the json feed as HTML

}

This technique is commonly called JSONP

You save some latency for your users by avoiding your PHP to proxy the requests.
And you won't pay the bandwidth for these data, as they come directly from Yahoo.

Unfortunately, all this is valid only if your target audience is javascript enabled.

Mic