Reputation: 3073
I am working with the pdf at the end of this URL
https://www2.blackrock.com/webcore/litService/search/getDocument.seam?venue=PUB_INS&source=CONTENT&serviceName=PublicServiceView&ContentID=51648
By viewing it, we can see that it's the 12/31/2012
edition. Is there a way that I can get some timestamp data on the pdf itself? Upload date, created date, modified date, anything in that ballpark?
I have tried the following and both return 12/31/1969
$pdfURL = 'https://www2.blackrock.com/webcore/litService/search/getDocument.seam?venue=PUB_INS&source=CONTENT&serviceName=PublicServiceView&ContentID=51648';
$rawPDF = file_get_contents($pdfURL);
echo date("F d Y H:i:s.", filemtime($pdfURL));
-AND-
echo date("F d Y H:i:s.", filemtime($rawPDF));
I have also tried
$headerArray = array();
$headerArray = get_headers($pdfURL, 1);
echo "<PRE>";
var_dump($headerArray);
echo "</PRE>";
However Last-Modified
doesn't exist in the header array
Upvotes: 2
Views: 2453
Reputation: 883
I answered previously and because i provided only a link, moderator deleted my answer and converted to a comment. Let's try now with more complete answer based on our comments:
From what I have analyzed, the HTTP header for a given link contains Last-modified field. But only if a link is directly to a file. However when you see that a link is the sort of somepage.pgp?file=file.pdf
kind, Last-modified won't be there.
In the first case, php function get_headers()
can be used, to read the field in question. I the latter case I'm afraid i cannot help you.
Upvotes: 2