3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php /* I somehow want this part..: $ch = curl_init(); curl_setopt($ch, CURLOPT_COOKIE, "birthtime=28801; path=/; domain=store.steampowered.com"); curl_setopt($ch, CURLOPT_TIMEOUT, 5); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($ch); *///To be sent with the DomXPath part, so the DOM fetches the site with the cookie placed to avoid age restriction - // - blocking it from fetching the description. // Need I execute the DOM using $result (tried that, failed miserably), or is there another way? $url = "http://store.steampowered.com/app/100"; $dom = new domDocument; libxml_use_internal_errors(true); $dom->loadHTMLFile($url); $classname="game_description_snippet"; $finder = new DomXPath($dom); $spaner = $finder->query("//*[contains(@class, '$classname')]"); foreach ($spaner as $spane) { $spanx = $spane->childNodes; $description = $spanx->item(0)->nodeValue; $GLOBALS['x'] = $description; } ?>
based on fbdl3
Output for 5.3.21 - 5.4.45, 5.5.33, 5.6.18 - 5.6.19, 7.0.4, 7.0.20, 7.1.5 - 7.2.0
Warning: DOMDocument::loadHTMLFile(): php_network_getaddresses: getaddrinfo failed: System error in /in/Yhnln on line 20 Warning: DOMDocument::loadHTMLFile(http://store.steampowered.com/app/100): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/Yhnln on line 20
Output for 5.5.24 - 5.5.32, 5.5.34 - 5.6.17, 5.6.20 - 7.0.3, 7.0.5 - 7.0.6, 7.1.0
Warning: DOMDocument::loadHTMLFile(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/Yhnln on line 20 Warning: DOMDocument::loadHTMLFile(http://store.steampowered.com/app/100): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/Yhnln on line 20