码迷,mamicode.com
首页 > 其他好文 > 详细

curl_setopt(): CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in

时间:2014-09-14 02:31:56      阅读:230      评论:0      收藏:0      [点我收藏+]

标签:blog   http   io   使用   ar   sp   cti   log   on   

当系统开启safe_mode和 open_basedir,在程序中使用以下语句
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
并且遇到301,302状态吗时会出现错误

[11-Oct-2010 14:17:41] PHP Warning: curl_setopt(): CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in msn.class.php on line 819

解决方法是在curl语句不使用curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true),或者改为0,在php函数中自定义一个函数

curl_redir_exec函数
curl_redir_exec

curl_redir_exec($ch)替换curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true)语句

参考:

http://spoint.babyshoot.cn/archives/2009/11/curlopt-php.html

http://www.php.net/manual/en/function.curl-setopt.php

curl_setopt(): CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in

标签:blog   http   io   使用   ar   sp   cti   log   on   

原文地址:http://www.cnblogs.com/baocheng/p/3970611.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!