I'm having trouble figuring out how to use PHP Simple HTML DOM Parser for pulling information from a website.
require('simple_html_dom.php'); $html = file_get_html('https://example.com'); $ret = array(); foreach($html->find(".project-card-mini-wrap") as $element) { echo $element; } The output of $element is:
<div class="project-card-mini-wrap"> <a class="project_item block mb2 green-dark" href="/projects/andrewkostirev/kostirev-the-real-you"> <div class="project_thumbnail hover-group border border-box mb1"> <img alt="Project image" class="hover-zoomin fit" src="https://ksr-ugc.imgix.net/projects/2123706/photo-original.png?v=1444253259&w=218&h=162&fit=crop&auto=format&q=92&s=9d6c437e96b720dce82fc9b598b3e8ae" /> <div class="funding_tag highlight">10 days to go</div> <div class="hover-zoomout bg-green-90"> <p class="white p2 h5">A clothing brand like never seen before</p> </div> </div> <div class="project_name h5 bold"> KOSTIREV - THE REAL YOU </div> </a> </div> This is the information I'd like to pull from the website:
1: Link href
2: Image src
3: Project name