I am writing a wordpress shortcode and I need to get the contents of a specific div on each page that the shortcode is rendered on.
Here is my code so far
$dom = new DOMDocument(); $dom->loadHTML(//here is where the problem is); $xpath = new DOMXPath($dom); $hidden_listing_id = $xpath->query('//div[id="listing-id-hidden"]');
The div is structured like
<div id="listing-id-hidden" style="display: none;"> </div>
I know I can get the html of a specific url but how would I dynamically get the html of each page that I render the shortcode on.
Any help is appreciated!
Read more here: How to dynamically get html of page with PHP