2

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

mhopkins321
  • 2,993
  • 15
  • 56
  • 83
  • 1
    Is [this article] helpful in your case? [this article]: http://stackoverflow.com/questions/4326604/get-file-creation-date-over-http – Kitet Jan 24 '13 at 22:04
  • I think that would work, but I'm not entirely sure how I would utilize that with php. Guess I'll have to do some research – mhopkins321 Jan 24 '13 at 22:44
  • 1
    There's a PHP function [get_headers](http://php.net/manual/en/function.get-headers.php) use it then iterate over table that is returned and look for `Last-Modified` – Kitet Jan 24 '13 at 22:50
  • For that URL there isn't a "last-modified". – mhopkins321 Jan 24 '13 at 22:56
  • 1
    I can't access this url so i can't tell, but from what i saw on my own site, Last-modified field is available for directly accessible files (like where i hovered over a link and there was real path to a .PDF at the end), whereas for files dispensed from a script i couldn't find it (like where i have download.php?link=file.pdf – Kitet Jan 24 '13 at 23:16
  • Are you not located in the US? I'm not sure I know what you mean by "hover over the URL". I would also say throw you next response in an answer instead of a comment so that I can at least give you a green for the help you've given – mhopkins321 Jan 26 '13 at 15:23
  • No, I'n not from US. And hover over an ULR means with your mouse when the page is displayed, browsers give me info in some little popup at the bottom where this url is leading. Sorry I wasn't clear. – Kitet Jan 26 '13 at 19:29

1 Answers1

2

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.

Kitet
  • 855
  • 1
  • 10
  • 20