How to get the last URL fetched by cURL?
curl, php
Solution
You can use `curl_getinfo()`.
http://php.net/manual/en/function.curl-getinfo.php
echo curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
Problem
If a given URL is redirected to another one, `cURL` will fetch the last one by ``` curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); ``` but how to record what was the last URL fetched by cURL? With ``` curl_setopt($ch, CURLOPT_URL, $link); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); ``` we do not know what was the actuall url fetched by `cURL`, as `$link` has been redirected to the final location. How to record the last location in a string?