开发者

Get timestamp from a webpage?

开发者 https://www.devze.com 2023-02-26 11:38 出处:网络
Is there a way to get the timestamp from a webpage? In this case, news stories webpage. I have tried isolating them in the string cont开发者_如何学Cents of the XHTML, but there is too much variation.

Is there a way to get the timestamp from a webpage? In this case, news stories webpage. I have tried isolating them in the string cont开发者_如何学Cents of the XHTML, but there is too much variation. i have searched all over, but all anyone is able to do is get the current date


Can you check the Last-Modified response header. See for details of the full list of headers.


You can get the header with the code below. Not many websites implement the last-modified date though.

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_NOBODY, TRUE); // remove body
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$head = curl_exec($ch); 
?>
0

精彩评论

暂无评论...
验证码 换一张
取 消