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

From: Date: Thu, 10 Mar 2005 20:52:46 +0000
Subject: Re: how to verify image and not http error is returned to browser
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-210471@lists.php.net to get a copy of this message
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: [application/pgp-signature] OpenPGP digital signature signature.asc
« previous php.general (#210471) next »