你可以用你的apache日誌來驗證發生了什麼。通常這會導致至少知道數據是否達到您的預期。
你可以在PHP中做到這一點,可能會得到更多的反饋。特別是因爲php CLI配置對通知和錯誤非常大聲。仍然從命令行執行,把它放在一個php文件中,並用php二進制文件執行php文件,而不是直接執行curl。如果你安裝了PHP,當然。如果你不知道它是什麼,請將代理的東西留空。
PHP例子:
<?PHP
$data='x_response_code=1&x_response_reason_code=1&x_response_reason_text=This+transaction+has+been+approved.&x_ship_to_city=auburn&x_ship_to_state=New+York&x_ship_to_zip=13021&x_ship_to_country=United+States&x_amount=2.00&x_tax=0.00&x_duty=0.00&x_freight=0.00&x_tax_exempt=FALSE&x_po_num=&x_MD5_Hash=AF489908B0730A34FF3DF9&x_cvv2_resp_code=M&x_cavv_response=&x_test_request=false';
$response=curl_post_data_and_return('http://catalog.example.com/capture/CaptureAllFormData.php',$data,'','off');
echo "<pre>";
print_r($response);
function curl_post_data_and_return($site,$data,$proxy,$proxystatus){
$ch = curl_init();
if ($proxystatus == 'on') {
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, TRUE);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_URL, $site);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
// curl_setopt($ch, CURLOPT_COOKIEFILE, "xxx.cookie.txt");
// curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
// curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
// curl_setopt($ch, CURLOPT_REFERER, 'http://www.example.com//search.asp');
ob_start(); // prevent any output
return curl_exec ($ch); // execute the curl command
ob_end_clean(); // stop preventing output
curl_close ($ch);
}
也許您的服務器崩潰,如果你打它'POST' – 2014-10-06 18:02:27
看起來你的URL應該是'http:// localhost:1112/DOTHINGS' – 2014-10-06 18:03:40
@glennjackman就是這樣......我沒有想到表單動作是一個URL。所以curl正在尋找一個可操作的URL作爲參數? – AmericanKryptonite 2014-10-06 18:23:15