Hi guys. I have been using the wikipedia API to retrieve information about a topic. Ive managed to get a response and retrieve the first section of the topic (in this case football)
Using this method - http://en.wikipedia.org/w/api.php?action=parse&page=’.$search.’&redirects=1&format=json&prop=text§ion=0’);
However the first section that is retrieved includes the pictures and i just want to main text from the introduction.
The code that is sent back from wiki is this -
[code]Array
(
[parse] => Array
(
[text] => Array
(
[*] =>
The game of football is any of several similar team sports, of similar origins which involve advancing a ball into a goal area in an attempt to score. Many of these involve kicking a ball with the foot to score a goal, though not all codes of football using kicking as a primary means of advancing the ball or scoring. The most popular of these sports worldwide is association football, more commonly known as just "football" or "soccer". Unqualified, the word football applies to whichever form of football is the most popular in the regional context in which the word appears, including American football, Australian rules football, Canadian football, Gaelic football, rugby league, rugby union and other related games. These variations are known as "codes".
[/code]I want the code that resides in the
tags. How would i go about parsing this and removing the rest. ive tried to get to work simple html dom parser but with no luck.
Any help would be greatly appreciated
Thanks,
DIM3NSION