Im trying to get URL of final website im getting redirected. Link i go is- http://www.primewire.ag/external.php?url=aHR0cDovL3d3dy5wcm9tcHRmaWxlLmNvbS9sL0RBMTU1RjYwRUYtRkMyNzREQ0Q4RA
after you go that link you get redirected into- http://www.promptfile.com/l/DA155F60EF-FC274DCD8D
I want to get second URL. I found similar question in here
But using code that i got from there
$url= 'http://www.primewire.ag/external.php?url=aHR0cDovL3d3dy5wcm9tcHRmaWxlLmNvbS9sL0RBMTU1RjYwRUYtRkMyNzREQ0Q4RA';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // Must be set to true so that PHP follows any "Location:" header
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$a = curl_exec($ch); // $a will contain all headers
$url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL); // This is what you need, it will return you the last effective URL
// Uncomment to see all headers
/*
echo "<pre>";
print_r($a);echo"<br>";
echo "</pre>";
*/
echo $url; // Voila
echos out first URL not redirected URL. Thank you