How to get (scrap) value of unique element by ID from external website using php?

How to get (scrap) value of unique element by ID from external website using php?

 

$url = 'https://seatemperature.ru/current/abkhazia/gagra-sea-temperature';

$content = file_get_contents($url);

 

 

$dom = new DomDocument();

@ $dom->loadHTML($content,LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);

$element = $dom->getElementById('temp1'); //DOMElement

print_r($element->nodeValue); 

or

//$dom->saveHTML($element));

Article Details

Article ID:
51
Date added:
08.06.2021 01:17:20
Views:
169
Rating (Votes):
(1)