php simple html dom
Posted in
2418
12:39 pm, March 13, 2024
find a custom data attribute in simple html dom
locate the div based on a custom data attribute, in this case the data-field="regularMarketChange"
HTML
<div data-field="regularMarketChange">content</div>
PHP
// basic usage
$tag_search = "[data-field=regularMarketChange]";
$found_item = $item->find($tag_search,0)->plaintext;
// add a test to check the item is not null and will not throw an error or warning
$tag_search = "[data-field=regularMarketChange]";
if(null !== $item->find($tag_search,0)) {
$found_item = $item->find($tag_search,0)->plaintext;
}
content
View Statistics
This Week
11
This Month
18
This Year
2418
Add Comment
Other Items in php simple html dom
Related Search Terms
Other Categories in Code
alpine js apps c css factorio font awesome images linux quick modals sqlite site bugs site updates slick slider sliders testing windows apps apache api apps asp bat bootstrap bootstrap templates charts cookies core css css filters css grid design elements docker domains emoji fancybox fonts foundation framework gimp git html icons ideas image formatting images javascript javascript functions jquery js linux mac misc modals mysql nginx node php php errors php function php functions php simple html dom pi400 python react regex sections simple_html_dom simplepie php site bugs site documentation slick slider sql sqlite ssh sublime svg svg css templates tools virtual box vscode vue webdev windows windows 11 windows commands wordpress