troubleshooting Question

PHP Sctrapper

Avatar of pc-buddy
pc-buddy asked on
LaravelPHP
13 Comments1 Solution268 ViewsLast Modified:
Hi,

I cant make this code work, I'm using the simple dom scrapper, it should

1. grab all current live urls
2. use the simple html dom to find a set div on the page
3. grab the text within that div
4. print each one out on the page.

<?php
// example of how to use basic selector to retrieve HTML contents
include('simple_html_dom.php');
 
// grab the list of urls
$html = file_get_html('https://system.playtimenurseries.com/children/');

// find all link
foreach($html->find('a') as $e) {
$link = $e->href . '/invoices/2016/11';

foreach ($link as $p)
{
$html2 = file_get_html($p);

foreach($html2->find('div#gbar') as $i){
    echo $i->innertext . '<br>';
       }
    }
}
?>
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 13 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 13 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros