【发布时间】:2019-07-01 21:56:35
【问题描述】:
我需要 opencart 的自动购买脚本。注册和购物车工作良好。我发现 XHR 发布请求以保存结果,但是当我尝试结帐订单时出现此错误:
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, 'http://some_url.com/index.php?route=checkout/payment_method/save');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'payment_method=pp_pro&comment=&agree=1');
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookies.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
print $data;
{"error":{"warning":"Warning: Payment method required!"}}
【问题讨论】:
-
其中哪一部分不起作用,您预计会发生什么?要具体并详细说明。
-
index.php?route=checkout/payment_address - 给我真实的信息。但接下来的步骤只返回我的模板。
标签: php curl xmlhttprequest opencart