Extract data from website via PHP

后端 未结 6 548
难免孤独
难免孤独 2020-12-23 15:43

I am trying to create a simple alert app for some friends.

Basically i want to be able to extract data \"price\" and \"stock availability\" from a webpage like the f

6条回答
  •  情深已故
    2020-12-23 16:17

    The simplest method to extract data from Website. I've analysed that my all data is covered within tag only, so I've prepared this one.

    load_file($page);
    
            // Find all links
            $links = array();
            //Within find() function, I have written h3 so it will simply fetch the content from 

    tag only. Change as per your requirement. foreach($html->find(‘h3′) as $element) { $links[] = $element; } reset($links); //$out will be having each of HTML element content you searching for, within that web page foreach ($links as $out) { echo $out; } ?>

提交回复
热议问题