hello there. i was just wondering.is it possible to get the text display of your div and place it in a variable? if so, how should i do it? i've been searching for a solution in this problem but i can't find anything.thanks in advance.
Jump to Post
You can use the PHP Document Object Model (DOM), an example:
<?php $f = ' <html> <head> <title>test</title> </head> <body> <div id="aaa">apples</div> <div id="bbb">oranges</div> </body> </html> '; $dom = new domDocument; $dom->loadHTML($f); $dom->preserveWhiteSpace = false; $t = $dom->getElementsByTagName('div'); $newElement = $t->item(0)->nodeValue; // 0 to display #aaa, 1 …
All 2 Replies
Be a part of the DaniWeb community
We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.