Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- Get URL redirected url?


janton - 8:56 am on Jun 25, 2008 (gmt 0)


Thx thx Little_G

But it did'n work... :(
Here is what I did and also my link, so you can try it maby?

<?php
$ch = curl_init("http://example.com/file/get/Movtrailer-trailer_deadspace514.mov");

curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);

$header = "Location: ";
$pos = strpos($response, $header);
$pos += strlen($header);
$redirect_url = substr($response, $pos, strpos($response, "\r\n", $pos)-$pos);
echo $redirect_url;
?>

This gave me a blaco screen.

So this is my link: http://example.com/file/get/Movtrailer-trailer_deadspace514.mov

and if you past it in your browser you get:
[s9.video.example.com...]

[edited by: coopster at 12:03 pm (utc) on June 25, 2008]
[edit reason] please use example.com [/edit]


Thread source:: http://www.webmasterworld.com/php/3681920.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com