How do I CURL www.google.com - it keeps redirecting me to .co.uk

前端 未结 7 2518
南笙
南笙 2021-02-19 16:06

I am using CURL to check for the existence of a URL (HEAD request) but when I test it with www.google.com, it redirects me to www.google.co.uk - probab

7条回答
  •  孤街浪徒
    2021-02-19 16:49

    You should turn off the follow location from curl (set it to false) and you won't be redirected anymore ...

       curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
    

提交回复
热议问题