错误表示safe_mode或open_basedir ARE已启用(可能是open_basedir),如果您的主机有任何体面的安全设置,您可能无法重写.
所以你有选择
1)改变主持人(不可想象我想象)
以下是第2点中指定的功能的固定版本
function curl_redirect_exec($ch,&$redirects,$curlopt_header = false) {
curl_setopt($ch,CURLOPT_HEADER,true);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
$data = curl_exec($ch);
$http_code = curl_getinfo($ch,CURLINFO_HTTP_CODE);
if ($http_code == 301 || $http_code == 302) {
list($header) = explode("\r\n\r\n",$data,2);
$matches = array();
preg_match("/(Location:|URI:)[^(\n)]*/",$header,$matches);
$url = trim(str_replace($matches[1],"",$matches[0]));
$url_parsed = parse_url($url);
if (isset($url_parsed)) {
curl_setopt($ch,CURLOPT_URL,$url);
$redirects++;
return curl_redirect_exec($ch,$redirects,$curlopt_header);
}
}
if ($curlopt_header) {
return $data;
} else {
list(,$body) = explode("\r\n\r\n",2);
return $body;
}
}