I have this request http://en.wikipedia.org/w/index.php?action=raw&title=Greece and i am trying to get several information out of it: language, currency, long/lat etc. Is there an easy way to get this data with php?
Asked
Active
Viewed 103 times
-1
-
It appears regular expressions would work well so long as you are getting data only from the top part. ie not for the HTML parts. – thatidiotguy Oct 23 '12 at 16:00
-
You'll have to parse it yourself, but expect the page to change regularly and your parser to fail. – Matt S Oct 23 '12 at 16:00
-
Read [How to parse Wikipedia XML with PHP?](http://stackoverflow.com/questions/4839938/how-to-parse-wikipedia-xml-with-php) – Aamir Oct 23 '12 at 16:04
-
so how would you do it? Is there a safe way? – cosapostolo Oct 23 '12 at 16:04
1 Answers
1
You could parse the file with PHP but i found a projekt which do it.
there are some examples.
Edit:
For an URL open the URL with
$wikiString = file_get_contents('http://url.de');
then you have the result and you can work with it.

René Höhle
- 26,716
- 22
- 73
- 82
-
This seems like a solution, but can it process a url? Can I get dynamic results?(change greece to italy eg) – cosapostolo Oct 23 '12 at 16:09