Use WP_Query to pull content from external site.
-
I want to pull just the “Flower” category table from this site. Not the whole menu.
Already tried
<?php $doc = new DOMDocument; // We don't want to bother with white spaces $doc->preserveWhiteSpace = false; // Most HTML Developers are chimps and produce invalid markup... $doc->strictErrorChecking = false; $doc->recover = true; $doc->loadHTMLFile('https://www.leafly.com/dispensary-info/new-vansterdam/menu'); $xpath = new DOMXPath($doc); $query = "//div[@class='m-accordion--main-group" data-ng-show="'Flower' == filterItem || filterItem == 'all']"; $entries = $xpath->query($query); var_dump($entries->item(0)->textContent); ?>
and I got this error
Parse error: syntax error, unexpected ‘data’ (T_STRING) in /home/nvmain1/public_html/www2/wp-content/themes/theme/CherryFramework/page-flower.php on line 64
Would this be possible as an I-frame?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Use WP_Query to pull content from external site.’ is closed to new replies.