Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $test = <<<END
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>Test case</title>
- </head>
- <body>
- <img alt="foo" src="foo.jpg">
- <img alt="bar"src="bar.jpg">
- </body>
- </html>
- END;
- require 'simplehtmldom_1_5/simple_html_dom.php';
- $html = new simple_html_dom();
- $html->load($test);
- echo '<pre>';
- foreach ($html->find('img') as $img) {
- $tag = htmlentities($img->outertext);
- echo "$tag\n";
- }
- /*
- Output:
- <img alt="foo" src="foo.jpg">
- <img alt="bar">
- */
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement