How to get the last URL fetched by cURL?

前端 未结 1 1639
情话喂你
情话喂你 2021-01-12 06:48

If a given URL is redirected to another one, cURL will fetch the last one by

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

b

1条回答
  •  清酒与你
    2021-01-12 07:17

    You can use curl_getinfo().

    http://php.net/manual/en/function.curl-getinfo.php

    echo curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
    

    0 讨论(0)
提交回复
热议问题