curl follow location error

前端 未结 6 1050
耶瑟儿~
耶瑟儿~ 2020-11-27 06:48

I got this error message:

CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in.

safe_mode i

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-27 07:34

    Just a note:

    All answers with code here manually parse the headers from a curl request to find a Location: header.

    However, since PHP 5.3.7, there is an option CURLINFO_REDIRECT_URL you can use with curl_getinfo(). No need to do requests twice, no need to enable headers if you don't want them, no need for regexps.

提交回复
热议问题