PluginProbe
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript / 1.9.3
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript v1.9.3
4.1.16 4.1.15 4.1.14 4.1.13 4.1.12 4.1.11 4.1.10 4.0.30 4.0.29 4.0.28 4.0.27 4.0.26 4.0.24 4.0.25 4.0.23 4.0.22 4.0.21 4.0.19 4.0.18 4.0.17 4.0.16 1.9.3 1.9.4 1.9.5 1.9.6 All 170 releases
searchpro / simplehtmldom / example / example_callback.php

example_callback.php in BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript 1.9.3, at simplehtmldom/example/example_callback.php

28 lines 577 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 include_once('../simple_html_dom.php');
3
4
5 // 1. Write a function with parameter "$element"
6 function my_callback($element) {
7 if ($element->tag=='input')
8 $element->outertext = 'input';
9
10 if ($element->tag=='img')
11 $element->outertext = 'img';
12
13 if ($element->tag=='a')
14 $element->outertext = 'a';
15 }
16
17
18 // 2. create HTML Dom
19 $html = file_get_html('http://www.google.com/');
20
21
22 // 3. Register the callback function with it's function name
23 $html->set_callback('my_callback');
24
25
26 // 4. Callback function will be invoked while dumping
27 echo $html;
28 ?>