Враппер http
<?php
$url = 'http://www.example.com/redirecting_page.php';
$fp = fopen($url, 'r');
/* Prior to PHP 4.3.0 use $http_response_header
instead of stream_get_meta_data() */
$meta_data = stream_get_meta_data($fp);
foreach($meta_data['wrapper_data'] as $response) {
/* Were we redirected? */
if (substr(strtolower($response), 0, 10) == 'location: ') {
/* update $url with where we were redirected to */
$url = substr($response, 18);
}
}