Community Forums 

Main Content

Post to cart using cURL

    May 15 2009 22:05:56



    Join date : 2008-09-18      Posts : 28

    Looking for advice on posting to the shopping cart using cURL. Basically what I'm looking to do is the following:

    Form => php processing page => shopping cart

    On the processing page, input from the form is cleaned up and prepared with the correct field names to be sent to cart, and then sent to the cart using cURL.

    You're going to ask why I can't just make the field names what they are supposed to be and the answer to that is that I cannot use product[] on the form page because of javascript form field validation being used.

    Attempts to do this result in what *looks* like a post to the cart, but closer examination shows the processing page url in the location bar shopping cart info in the browser.

    I'm using the most basic setup, with CURLOPT URL, POST, & POSTFIELDS....

    Any advice/info gratefully accepted!

    May 15 2009 23:56:57


    Debbie Q

    Join date : 2008-09-18      Posts : 4998

    I can't help whatso ever with cURL but maybe you don't need it? When using product[] in the code the cart ignores anythng within the brackets. SO you can make each field unique for your validation script by putting something inside the brackets. product[a], product

    Debbie Q

    Mal's Support:
    GT's Forms and examples:
    Helpful java scripts:
    Shipping help documents:

    My Create-A-Book Publishing -
    Personalized Books, Music CDs and Gifts for all ages and occasions.

    Please help me out and share my site on your networks.

    May 16 2009 00:04:20



    Join date : 2008-09-18      Posts : 488

    Curl isn't going to work very well. The issue is the cart uses cookies on the client. If you use curl the client is the script, not the actual client. You could do what optioncart and others do, which is submit to your own php script that builds a buy now link then redirects to that link.

    May 16 2009 01:38:05



    Join date : 2008-09-18      Posts : 28

    Thanks for the input!

    Not sure which idea I'll go with - but both are appreciated!

    May 16 2009 05:41:20



    Join date : 2008-09-18      Posts : 2986

    You can also use id= to identify a statement .

    For examples see

    Some shipping help documents are available at

    Sep 11 2009 01:34:33



    Join date : 2008-09-18      Posts : 53

    Curl will POST to a URL but the URL from which you post will be the same in your browser; it will not go to the URL where you post.

    Doug D

    Doug D
    Smartlab Software