'How do I find correct xpath on this HTML in PHP?

I can't figure out how to grab a text on this page: https://explorer.helium.com/hotspots/115YHWje2vCPkKzsQCm5ZrJ1KBma5294HvAsSmfVLw3iyuDq29e/activity (or on similar pages) I need the time/string form the very first row of the activity tab.

Text

In this case, it's the "3h". In the source it should be the first <time>-tag.

This is the function i wrote:

function getActivityInfo($url) {
    libxml_use_internal_errors(true);

    $doc = new DOMDocument;

    try {
        $content = utf8_encode(file_get_contents($url));
    } catch (Exception $ex) {
        echo "file_get_contents failed, " . $ex;
        $content = false;
        return false;
    }

    if ($content != false) {

        $doc->loadHTML($content);
        $xpath = new DOMXpath($doc);
        
        $nodeList = $xpath->query("//time");

        foreach ($nodeList as $node) {
            var_dump($node);
            echo $node->nodeName . "\n";
        }
    }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source