Re: how to verify image and not http error is returned to browser

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Cindy Reeves wrote:
...
>
> I don't trust their server will always be up/respond, so I want to use a PHP
> function to determine whether a GIF has been returned (oppsed to an HTTP
> error) before sending it to the browser. Any recommendations how to do this?
>

Several ways to skin this cat.  cURL is your friend.

http://php.net/manual/en/ref.curl.php

- Use cURL to check the headers for the image/gif header (though this
doesn't guarantee that it is a gif...)
- store the curl_exec() result (string) into a buffer and check for
actual GIF content.  *Note* I have no clue what exactly makes up a GIF
file, but you can google "GIF file format" and check the file content if
you're paranoid.

--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux