0
$html = file_get_html('https://m.gsmarena.com/');
$videos = [];
foreach ($html->find('div.swiper-half-slide') as $video) {
foreach ($video->find('strong')as $name){

   echo $name->innertext;
   $videos[]=$name;
}}
print_r($videos);

im getting fatalerror Allowed memory size of 536870912 bytes exhausted (tried to allocate 268439552 bytes) in C:\xampp\htdocs\scrappingpractise\scraper.php on line 24

2

1 Answer 1

1

You are running out of memory, by default PHP allows you to allocate 256mb for each execution. You can change it in your php.ini file, the option it's called memory_limit

2
  • i have changed memory limit to 1000M but still not working
    – Faateih
    Commented Feb 18, 2020 at 10:39
  • Have you tried restarting your apache server? You have to do that every time you change something in the php.ini file
    – Daniel
    Commented Feb 18, 2020 at 10:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.