Re: searching non plain text files
| From: | Tedd Sperling | Date: | Sun, 16 Dec 2018 19:33:25 +0000 |
| Subject: | Re: searching non plain text files | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-326642@lists.php.net to get a copy of this message | ||
> On Dec 14, 2018, at 11:19 PM, Jeffry Killen <jekillen@prodigy.net> wrote:
>
>
> Can anyone point me to instruction/advice about
> opening and reading files that are not plain text:
Jeffry:
I don’t know if this will help you, but most “honest” files have a header that states what it
is.
Try using a hex-editor app and observing the first 10 characters in their headers (i.e., start of
the file). For example, a PDF file will state ‘PDF’, a jpg will state ’JFIF’, a rtf file
will state ‘rtf’, a zip file will state ‘PK”, a png will state ‘PNG”, and so on.
From that observation, you might try working with bin2hex or dechex and other such bin/hex functions
PHP provides to check what the file type is in the header and what it reports itself to be in the
extension.
Additionally, you can always Google it.
Cheers,
Tedd
_______________
tedd sperling
tedd@sperling.com