Extract paragraphs from Wikipedia API using PHP cURL Extract paragraphs from Wikipedia API using PHP cURL curl curl

Extract paragraphs from Wikipedia API using PHP cURL


The \n\n are literally those characters, not linefeeds. Make sure you use single quotes around the string in explode:

$parts = explode('\n\n', $text);

If you choose to use double quotes you'll have to escape the \ characters like so:

$parts = explode("\\n\\n", $text);

On a side note: Why do you retrieve the data in two different formats? Why not go for only JSON or only XML?