OK, so I have a few pages that parse data from a 3rd party website everytime the page is loaded. I am wanting to prevent this and set up my website a way so that it doesn't parse the data from the 3rd party site everytime the page is opened but maybe only a couple times a day (to update the data). To do this, I am wanting to make a copy of the 3rd party page, save it onto my site, then allow my other page to parse data from the copy everytime it is opened.
So I have thought up the current method:
Code: Select all
$contents = file_get_html('http://www.site.com/');
file_put_contents('test.html', $contents);
$contents = file_get_html('http://www.site.com/2');
file_put_contents('test2.html', $contents);
$contents = file_get_html('http://www.site.com/3');
file_put_contents('test3.html', $contents);
$contents = file_get_html('http://www.site.com/4');
file_put_contents('test4.html', $contents);
However, after putting too many sites in here, I get the error:
Code: Select all
Fatal error: Allowed memory size of 18874368 bytes exhausted (tried to allocate 40 bytes) in /etc/etc/etc/simple_html_dom.php on line 618
So, what do I need to do to keep from taking up all the memory or should I be using a different method for doing this altogether?