Wikipedia JSON API with PHP
I'm trying to get the content of wikipedia ( in Bulgarian language ) using
it's API with the following code:
$content =
file_get_contents("http://bg.wikipedia.org/w/api.php?format=json&action=query&titles=%D0%A1%D0%BE%D1%84%D0%B8%D1%8F&prop=revisions&rvprop=content");
The problem is that the result look like this:
........."*":"{{\u043a\u044a\u043c
\u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u0435|\u0421\u043e\u0444\u0438\u044f|\u0421\u043e\u0444\u0438\u044f
(\u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u0435)}}\n{{\u0421\u0435\u043b\u0438\u0449\u0435
\u0432 \u0411\u044a\u043b\u0433\u0430\u0440\u0438\u044f\n|
I'm getting this result even if I open the link in a browser. If I change
the JSON to XML it works nice, but if the format is JSON, the content is
"unreadable".
How I can get readable text? Or is there any other simple solution for
parsing the paragraphs with its content from wikipedia?
No comments:
Post a Comment