3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = file_get_contents('http://www.amazon.com/Now-Foods-Vitamin-100mcg-Liposomal/dp/B0045MJNCU'); //get the html returned from the following url $pokemon_doc = new DOMDocument(); libxml_use_internal_errors(TRUE); //disable libxml errors if(!empty($html)){ //if any html is actually returned $pokemon_doc->loadHTML($html); libxml_clear_errors(); //remove errors for yucky html $pokemon_xpath = new DOMXPath($pokemon_doc); //get all the h2's with an id $pokemon_row = $pokemon_xpath->query('//*[@id="price"]/table/tbody/tr[1]'); if($pokemon_row->length > 0){ foreach($pokemon_row as $row){ echo $row->nodeValue . "<br/>"; } } } ?>
Output for git.master, git.master_jit, rfc.property-hooks
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo for www.amazon.com failed: System error in /in/Vh2HA on line 2 Warning: file_get_contents(http://www.amazon.com/Now-Foods-Vitamin-100mcg-Liposomal/dp/B0045MJNCU): Failed to open stream: php_network_getaddresses: getaddrinfo for www.amazon.com failed: System error in /in/Vh2HA on line 2

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
37.08 ms | 402 KiB | 8 Q