0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.139.86.53


Current Path : /proc/thread-self/root/kop/Regulations/simplehtmldom/example/
Upload File :
Current File : //proc/thread-self/root/kop/Regulations/simplehtmldom/example/example_callback.php

<?php
// This example illustrates how to utilize the callback feature to manipulate the DOM
include_once '../HtmlWeb.php';
use simplehtmldom\HtmlWeb;

// Write a callback function with one parameter for the element
function my_callback($element) {
	if ($element->tag === 'a') { // Invalidate all anchors
		$element->href = '#';
	}
}

// Load the document
$doc = new HtmlWeb();
$html = $doc->load('https://www.google.com/');

// Register the callback function
$html->set_callback('my_callback');

// The callback function is invoked automatically when accessing the contents.
echo $html;