Answer the question
In order to leave comments, you need to log in
How can the parser be improved?
At the moment, the parser is parsing the entire UpTime string. (including words about the time the site worked without errors). What should be changed in the parser so that it displays only the uptime value and nothing more? Attached is the parser code.
<?php
function browser($url) {
$url="http://ping-admin.ru/free_uptime/stat/761d80929682cbfc470a4a9322dd5b109541.html";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)");
$html = curl_exec($ch);
curl_close($ch);
return $html;
}
preg_match_all('~<td class="lst">(.*?)</td>~is', browser($url), $text);
print implode('<br />', array_slice($text[1], 1, 1)); //вывод строки UpTime
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question