# searchpro/1.9.6/simplehtmldom/example/example_modify_contents.php

BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS &amp; JavaScript, version 1.9.6. 18 lines.

- Page: https://pluginprobe.com/plugins/searchpro/1.9.6/code/simplehtmldom/example/example_modify_contents.php
- Raw: https://pluginprobe.com/plugins/searchpro/1.9.6/raw/simplehtmldom/example/example_modify_contents.php
- Modified: 2024-08-20T18:00:30+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/searchpro/1.9.6/code/simplehtmldom/example/example_modify_contents.php#L10-L20`.

```php
<?php
// example of how to modify HTML contents
include('../simple_html_dom.php');

// get DOM from URL or file
$html = file_get_html('http://www.google.com/');

// remove all image
foreach($html->find('img') as $e)
    $e->outertext = '';

// replace all input
foreach($html->find('input') as $e)
    $e->outertext = '[INPUT]';

// dump contents
echo $html;
?>
```
