want to grab wikipedia articles
-
Hi, I have this code and want to know how to extend it that way so it gets tags for a post and display each articles based on a single tag. The code is:
function get_wiki($search) { if(!$search) return false; $url = "https://de.wikipedia.org/w/api.php?format=xml&action=parse&page=".$search; $xml = simplexml_load_file($url); $text = $xml->parse->text; if(!$text) return false; $reg_exp = '/<p>(.*?)<\/p>/s'; preg_match_all($reg_exp, $text, $match); $summary = $match[0][0]; if($summary == "<p><b>Artikel verschwunden?</b></p>") return false; $summary = ereg_replace('href="/wiki/', 'href="/ueber/', $summary); return $summary; }
Now I’d like to know how and where to add get tags and make the code do seperate every tag so it gets tags one by one and not all of them at once like “tage1tag2tag3” it should be:
tag1tag2
tag3
would be great if you can tell me how and where to add that code.
Kind regards
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘want to grab wikipedia articles’ is closed to new replies.