0
我需要在wordpress woocommerce中使用curl下訂單。我已經嘗試過,但它不工作。我的錯誤使用curl的Woocommerce地方訂單?
{"result":"failure","messages":" \n\t\t\t
We were unable to process your order, please try again.<\/li>\n\t<\/ul>\n","refresh":"true","reload":"false"}
我的代碼如下
$datas = "billing_country=IN&billing_first_name=renuka&billing_last_name=fg&billing_company=fsdfgdf&billing_address_1
=dsfdsfsd+fdfsdf&billing_address_2=fsdfsdfsdf&billing_city=madurai&billing_state=BR&billing_postcode
=6334535&billing_email=renuka%40osiztechnologies.com&billing_phone=2343546&shipping_country=IN&shipping_first_name
=renuka&shipping_last_name=fg&shipping_company=fsdfgdf&shipping_address_1=dsfdsfsd+fdfsdf&shipping_address_2
=fsdfsdfsdf&shipping_city=madurai&shipping_state=BR&shipping_postcode=6334535&order_comments=&shipping_method
%5B0%5D=free_shipping&payment_method=braintree&braintree-card-expiry-month=10&braintree-card-expiry-year
=2032&_wpnonce=a5dbf257ca&_wp_http_referer=%2Fprojects%2Ftutor%2Fwp-admin%2Fadmin-ajax.php";
$ch = curl_init('http://localhost/project/wp-admin/admin-ajax.php?action=woocommerce_checkout');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $datas);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);