For starters, you're telling this to loop until $i
is greater than 10
, which in practice, will loop until the server request times out. Change it to $i<10
, or if you need only a handful of sections, try:
foreach (array(1,3,5,6,7) as $i)
//your code
Second, decoding JSON into an associative array like this:
$json = json_decode($c, true);
And referencing it like $json['parse']['text']['*']
is easier to work with, but that's up to you.
And third, you'll find that strip_tags()
will likely function faster and more accurately than stripping tags with regular expressions.