我正在使用cURL进行HTTP POST。
$url = "http://localhost:8080/~demo/cgi-bin/execute/100";
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,count($data));
curl_setopt($ch,CURLOPT_POSTFIELDS,$data);
//execute post
$result = curl_exec($ch);
echo("$result");
//close connection
curl_close($ch);
帖子已执行,但响应显示错误:
The requested URL /~demo/100 was not found on this server.
显然,上述URL不存在于服务器上,因为(不知何故)cURL改变了URL。
它应该是/~demo/cgi-bin/execute/100
。这个URL在浏览器中可以使用。
Please tell me why does it do that? AND how can i stop this, for what I want?