Get timestamp from a webpage?
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);
?>
精彩评论