我在我的系统上设置了一个小的PHP脚本(运行XAMPP)并且它工作正常但是当我将它上传到我的网络服务器时它说:错误请求(无效数字)。可能是什么原因?
这是我的代码:
$url = "http://domain.com/filename.aspx?client=saad%40domain.com&oper=d&gname=g1";
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => false,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_ENCODING => "",
CURLOPT_USERAGENT => "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)",
CURLOPT_AUTOREFERER => true,
CURLOPT_CONNECTTIMEOUT => 120,
CURLOPT_TIMEOUT => 120,
CURLOPT_MAXREDIRS => 10,
CURLOPT_POST => true,
);
$ch = curl_init($url);
curl_setopt_array($ch, $options);
$content = curl_exec($ch);
$header = curl_getinfo($ch);
curl_close($ch);
print_r($header);
echo $content;
标题数组显示:
Array
(
[url] => http://domain.com/filename.aspx?client=saad%40domain.com&oper=d&gname=g1
[content_type] => text/html
[http_code] => 400
[header_size] => 129
[request_size] => 337
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 0.034575
[namelookup_time] => 0.029746
[connect_time] => 0.030606
[pretransfer_time] => 0.030615
[size_upload] => 0
[size_download] => 37
[speed_download] => 1070
[speed_upload] => 0
[download_content_length] => 37
[upload_content_length] => -1
[starttransfer_time] => 0.03455
[redirect_time] => 0
)
提前致谢!
答案 0 :(得分:6)
删除CURLOPT_POST选项解决了该问题。然而,它并没有在我的本地PC上造成任何问题。