3v4l.org

run code in 300+ PHP versions simultaneously
<?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; } ?>

preferences:
36.92 ms | 402 KiB | 5 Q