File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 11<?php
2+
23require_once (__DIR__ . "/utils/CrawlerDetector.php " );
4+ require_once (__DIR__ . "/utils/HTMLHelper.php " );
35?>
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ class HTMLHelper
4+ {
5+
6+ public function __construct ()
7+ {
8+
9+ }
10+
11+ /**
12+ * Returns an array with HTML objects of the given tag type contained in
13+ * the given html string.
14+ * @param string $tag the tag to search
15+ * @param string $html is the html string to search for tag objects
16+ * @return type array with html objects
17+ */
18+ public function GetAllTagsFromHTMLString (string $ tag , string $ html )
19+ {
20+ $ imgs = array ();
21+ preg_match_all ('/< ' . $ tag . '[^>]+>/i ' , $ html , $ result );
22+ for ($ i = 0 ; $ i < sizeof ($ result ); $ i ++)
23+ {
24+ $ imgs [$ i ] = $ result [0 ][$ i ];
25+ }
26+ return $ imgs ;
27+ }
28+ }
29+
30+ ?>
You can’t perform that action at this time.
0 commit comments