Skip to content

<?php
$url = "https://store.steampowered.com/app/658850/";

$doc = new DOMDocument;
libxml_use_internal_errors(true);
$doc->loadHTMLFile($url);
libxml_clear_errors();

$xpath = new DOMXpath($doc);

$title = $xpath->query('//div[@class="apphub_AppName"]');
if(count($title)) echo $title[0]->nodeValue . "\n";

$price = $xpath->query('//div[@class="discount_final_price"]');
if(count($price)){
    echo $price[0]->nodeValue . "\n";
} else{
    $price = $xpath->query('//div[@class="game_purchase_price price"]');
    if(count($price)){
        echo trim($price[0]->nodeValue) . "\n";
    }
}