<?php include_once('../simple_html_dom.php'); // 1. Write a function with parameter "$element" function my_callback($element) { if ($element->tag=='input') $element->outertext = 'input'; if ($element->tag=='img') $element->outertext = 'img'; if ($element->tag=='a') $element->outertext = 'a'; } // 2. create HTML Dom $html = file_get_html('http://www.google.com/'); // 3. Register the callback function with it's function name $html->set_callback('my_callback'); // 4. Callback function will be invoked while dumping echo $html; ?>
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
.svn | Folder | 2755 |
|
|
scraping | Folder | 2755 |
|
|
example_advanced_selector.php | File | 1.49 KB | 0755 |
|
example_basic_selector.php | File | 976 B | 0755 |
|
example_callback.php | File | 604 B | 0755 |
|
example_extract_html.php | File | 110 B | 0755 |
|
example_modify_contents.php | File | 378 B | 0755 |
|
simple_html_dom_utility.php | File | 927 B | 0755 |
|