There is a link for example site.ru/index.php?url=312
When you click on it throws for example an some site2.ru
How to programmatically determine the url address of this site2.ru
Google hour did not give anything, I do not even know which way to dig.
Find out the address where the redirect occurs, for example: I have a link http://vk.cc/cObdk when clicking on it will forward me to the main page of the hashcode, I need to pass a parameter to the script, for example $ url = "http: // vk. cc / cObdk "; he gave me $ endurl = "http://hashcode.ru/";
I tried this:
$ch = curl_init(); //GET запрос указывается в строке URL curl_setopt($ch, CURLOPT_URL, $pley[1]); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); //curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); curl_setopt($ch, CURLOPT_REFERER, 'http://сайт.com/'); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; rv:6.0.2) Gecko/20100101 Firefox/6.0.2'); $endurl = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL); $data = curl_exec($ch); curl_close($ch);
But in the end I get the source address, not the final one.