vendredi 8 mai 2015

Woocommerce place order using curl?

I need to place order using curl in wordpress woocommerce. i already tried this but its not working. My error

{"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"}

My code is given below

    $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);

Aucun commentaire:

Enregistrer un commentaire