Jump to content

PHP header question


mjbauer95

Recommended Posts

I'm not sure if this is what you're asking for, by file header I think you are looking to get file information such as file size, type, height, width, resolution (for images) etc. There are build-in functions for some of these: image functions, filesystem functionsIf you want to read these informations directly from files, it shouldn't be different from any other language as the file formats are standardized.Here is a table that shows where these informations are saved in some of the file formats.Hope it helped.

Link to comment
Share on other sites

On the other hand, if you're asking about HTTP request headers, files don't exactly have those; they're prefixed to files when the files are requested. EDIT: Although that might be the same info that Lulzim mentioned; I don't use those much so I'm not sure.

Link to comment
Share on other sites

Oh, I didn't know about that. But wouldn't it be hard to get that info about a file other than the currently requested one (i.e., the one that called the PHP that needs to know)?

Link to comment
Share on other sites

You can get_headers() on any file, even a remote one. Though with non-GET requests yes, the headers may be different.

$headers = get_headers("http://www.google.com/");

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...