PHP Classes

File: example/example_modify_contents.php

Recommend this page to a friend!
  Classes of Lars Moelleken  >  Simple HTML DOM  >  example/example_modify_contents.php  >  Download  
File: example/example_modify_contents.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Simple HTML DOM
Manipulate HTML elements using DOMDocument
Author: By
Last change: Update of example/example_modify_contents.php
Date: 11 months ago
Size: 402 bytes


Class file image Download

use voku\helper\HtmlDomParser;


// get DOM from URL or file
$html = HtmlDomParser::file_get_html('');

// replace all image
foreach ($html->find('img') as $e) {
$e->outertext = '<img src="foobar.png">';

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

// dump contents
echo $html;

For more information send a message to info at phpclasses dot org.