parent
03c1b1d072
commit
d685af74ce
1 changed files with 2 additions and 2 deletions
|
@ -22,14 +22,14 @@ function DetectRedirect($url)
|
|||
{
|
||||
if(parse_url($url, PHP_URL_HOST)==FALSE) {
|
||||
//die('Not a URL');
|
||||
return array( 'error' => 'Not a URL: '. escape ($url) );
|
||||
throw new Exception('Not a URL: '. escape ($url) );
|
||||
}
|
||||
$response = get_headers($url, 1);
|
||||
if(!empty($response['Location'])) {
|
||||
$response2 = get_headers($response['Location'], 1);
|
||||
if(!empty($response2['Location'])) {
|
||||
//die('too much redirection');
|
||||
return array( 'error' => 'too much redirection: '. escape ($url) );
|
||||
throw new Exception('too much redirection: '. escape ($url) );
|
||||
}
|
||||
else { return $response['Location']; }
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue