Use PHP Simple HTML DOM Parser to find .zip? -
Use PHP Simple HTML DOM Parser to find .zip? -
i'm new php simple html dom parser , i'm trying list links end in .zip
, -animal.jpg
i'm not sure how it.
i've tried searching on google no avail, below white page.
// create dom url or file $html = file_get_html('<domain removed>'); // find -animal image files foreach($html->find('-animal.jpg') $element) echo $element->href . '<br>'; // find zip files foreach($html->find('.zip') $element) echo $element->href . '<br>';
you utilize strpos()
search particular href. example:
$links = $html->find('a'); foreach($links $link) { if( (strpos($link->href, '-animal.jpg') !== false) || (strpos($link->href, '.zip') !== false) ) { echo $link->href . '<br/>'; } }
php html simple-html-dom
Comments
Post a Comment