Jump to content

PHP header question


mjbauer95
 Share

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...