Reputation: 201
Here is my PHP. It runs through a bunch of URLs to get similar data (current homeruns from baseball player profiles). However, I'm getting 'Allowed memory size exhausted', which leads me to think that PHP is just aggregating all this load_file data, even after I've used $html->find on it to get the data I want. How can I tell PHP to stop using data from load_file after I've already echo'ed out what I need?
include('simple_html_dom.php');
$json = file_get_contents("http://example.com/homeruns.json");
$elements = json_decode($json);
foreach ($elements as $element){
$html = new simple_html_dom();
$html->load_file($element->profileurl);
$currenthomeruns = $html->find('.homeruns .current',0);
echo $element->name, " currently has the following number of homeruns: ", strip_tags($currenthomeruns);
}
Upvotes: 1
Views: 59