Here is the JSON array I received:
{"parse":{"title":"List of Arrow episodes", "pageid":37371793, "text":{"*":"<div class=\"mw-parser-output\"><h3><span id=\"Season_7_.282018.E2.80.9319.29\"></span><span class=\"mw-headline\" id=\"Season_7_(2018\u201319)\">Season 7 (2018\u201319)</span><span class=\"mw-editsection\"><span class=\"mw-editsection-bracket\">[</span><a href=\"/w/index.php?title=List_of ...}
I want to fetch the content under parse->text->*
, but it's giving me an error.
Here's what I've tried:
if ($data = json_decode(@file_get_contents($api_url))) {
$content = $data->parse->text->*;
$content = Parser::doTableStuff($content)
header('Content-Type:text/html; charset=utf-8');
echo $content;
}
After debugging, I identified the problem is in the line $content = $data->parse->text->*;
When I tried doing: $content = $data->parse->text;
it works, so I suspect that the * syntax is not right.
Edit: I tried enclose * with {} and [], but it still giving an error.