note 52855 deleted from wrappers.http by sean

From: Date: Tue, 16 Aug 2005 13:51:08 +0000
Subject: note 52855 deleted from wrappers.http by sean
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-93740@lists.php.net to get a copy of this message
Note Submitter: tommacber at yahoo dot com ---- The example listed did not work for me since the meta tag is "Content-Location: " not "Location: ". I changed the code to: <html> <?php $rawurl = "http://www.economist.com"; $fp = fopen($rawurl, 'r'); // Prior to PHP 4.3.0 use $http_response_header // instead of stream_get_meta_data() $meta_data = stream_get_meta_data($fp); print_r($meta_data); foreach($meta_data['wrapper_data'] as $response) { /* Were we redirected? */ if (substr(strtolower($response), 0, 18) == 'content-location: ') { /* update $rawurl with where we were redirected to */ $rawurl = substr($response, 18); } } ?> </html>

« previous php.notes (#93740) next »