bodzgl
bodzgl

Reputation: 1

json and php news system

I have access to the api which generates news in json. for example for news id #9 I can get date from:

someserver.com/core/news/9

this page generates json data for the news.

How I can parse this date using jquery and make news system that will include all newses?

Upvotes: 0

Views: 446

Answers (2)

Jess
Jess

Reputation: 8700

Incase you change your mind, you can also do this with php (without browser restrictions, though the server would php).

$newsID = 9;
$json = file_get_contents("someserver.com/core/news/".$newsID);
$news = json_decode($json, true);
print_r($news);

Upvotes: 0

Eliasdx
Eliasdx

Reputation: 2180

Using jQuery.GetJSON(): http://api.jquery.com/jQuery.getJSON/

However the API provider must support JSONP otherwise you will run into browser restrictions. (Same origin policy)

Upvotes: 1

Related Questions