php Programming Glossary: getelementsbytagname
innerHTML in PHP's DomDocument? http://stackoverflow.com/questions/2087103/innerhtml-in-phps-domdocument dom formatOutput true dom load html_string domTable dom getElementsByTagName table foreach domTable as tables echo DOMinnerHTML tables ..
How do I make a simple crawler in PHP? http://stackoverflow.com/questions/2313107/how-do-i-make-a-simple-crawler-in-php new DOMDocument '1.0' @ dom loadHTMLFile url anchors dom getElementsByTagName 'a' foreach anchors as element href element getAttribute 'href'..
Simplify PHP DOM XML parsing - how? http://stackoverflow.com/questions/3405117/simplify-php-dom-xml-parsing-how fine was set earlier products xpath query query _prods doc getElementsByTagName 'product' foreach _prods as product foreach product childNodes.. with it. echo n n TRAVERSING UP AND DOWN n n product dom getElementsByTagName 'product' item 2 echo product tagName 'product' echo dom saveXML..
PHP Parse HTML code [duplicate] http://stackoverflow.com/questions/3627489/php-parse-html-code DOM new DOMDocument DOM loadHTML str get all H1 items DOM getElementsByTagName 'h1' display all H1 text for i 0 i items length i echo items..
Get Title and Meta Tags of External site http://stackoverflow.com/questions/3711357/get-title-and-meta-tags-of-external-site here doc new DOMDocument @ doc loadHTML html nodes doc getElementsByTagName 'title' get and display what you need title nodes item 0 nodeValue.. what you need title nodes item 0 nodeValue metas doc getElementsByTagName 'meta' for i 0 i metas length i meta metas item i if meta getAttribute..
Grabbing the href attribute of an A element http://stackoverflow.com/questions/3820666/grabbing-the-href-attribute-of-an-a-element with DOM dom new DOMDocument dom loadHTML html foreach dom getElementsByTagName 'a' as node echo dom saveHtml node PHP_EOL The above would find..
Highlight keywords in a paragraph http://stackoverflow.com/questions/4081372/highlight-keywords-in-a-paragraph element replaceChild fragment child string dom saveXml dom getElementsByTagName 'body' item 0 firstChild Results in p span class highlight foo..
php count xml elements http://stackoverflow.com/questions/4386465/php-count-xml-elements improve this question With DOM you can either use dom getElementsByTagName 'OfferName' length to count all OfferName elements only . length.. dom loadXml xml count all OfferName elements echo dom getElementsByTagName 'OfferName' length PHP_EOL 6 count all OfferNameList OfferName..
How do I remove a specific node using its attribute value in PHP XML Dom? http://stackoverflow.com/questions/457153/how-do-i-remove-a-specific-node-using-its-attribute-value-in-php-xml-dom xmlDoc load myXML categoryArray array main xmlDoc getElementsByTagName details item 0 mainElement xmlDoc getElementsByTagName details.. getElementsByTagName details item 0 mainElement xmlDoc getElementsByTagName details foreach mainElement as details currentCategory details.. foreach mainElement as details currentCategory details getElementsByTagName category foreach currentCategory as category categoryID category..
DOMDocument saveHTML without HTML wrapper? http://stackoverflow.com/questions/4879946/domdocument-savehtml-without-html-wrapper The suggested fix... postarray 'post_content' d saveXML d getElementsByTagName 'p' item 0 Only works when the content has no block level elements.. replacement keynode postarray 'post_content' d saveXML d getElementsByTagName 'p' item 0 postarray 'post_content' d saveXML d getElementsByTagName.. 'p' item 0 postarray 'post_content' d saveXML d getElementsByTagName 'body' item 1 postarray 'post_content' d saveXML d getElementsByTagName..
DOMDocument in php http://stackoverflow.com/questions/4979836/domdocument-in-php like div dom getElementById 'showContent' foreach div getElementsByTagName 'a' as link echo dom saveXML link But unless you are more specific..
PHP + DOMDocument: outerHTML for element? http://stackoverflow.com/questions/5404941/php-domdocument-outerhtml-for-element code doc new DOMDocument doc loadHTML content foreach doc getElementsByTagName a as link url link getAttribute href if strpos url .flv echo..
Ignore html tags in preg_replace http://stackoverflow.com/questions/8193327/ignore-html-tags-in-preg-replace DOMDocument doc loadXML str xp new DOMXPath doc anchor doc getElementsByTagName 'body' item 0 if anchor throw new Exception 'Anchor element..
|