Originariamente inviato da Laiton
Scusa, potresti postarmi il codice.
Ho il dubbio che sbaglio a fare qualcosa!
Nel file che scarichi ci sono molteplici esempi questo è quello di base
Codice PHP:
<?php
// example of how to use basic selector to retrieve HTML contents
include('../simple_html_dom.php');
// get DOM from URL or file
$html = file_get_html('http://www.google.com/');
// find all link
foreach($html->find('a') as $e)
echo $e->href . '
';
// find all image
foreach($html->find('img') as $e)
echo $e->src . '
';
// find all image with full tag
foreach($html->find('img') as $e)
echo $e->outertext . '
';
// find all div tags with id=gbar
foreach($html->find('div#gbar') as $e)
echo $e->innertext . '
';
// find all span tags with class=gb1
foreach($html->find('span.gb1') as $e)
echo $e->outertext . '
';
// find all td tags with attribite align=center
foreach($html->find('td[align=center]') as $e)
echo $e->innertext . '
';
// extract text from table
echo $html->find('td[align="center"]', 1)->plaintext.'
<hr>';
// extract text from HTML
echo $html->plaintext;
?>