Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7

Thread: HTTP Response

  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    HTTP Response

    I'm working on a custom shopping cart for my wife's small work-at-home business. The cart is working as expected and I'm up where I need to transmit the data to the payment gateway.

    Using a secure connection, we are transmitting the necessary data to the gateway. I have a form setup with the form action set to the gateway's server.

    I can't seem to wrap my head around how to read the response from the gateway. The transaction responses are returned in the body of the HTTP
    response in a query string name/value format delimited by ampersands. For
    example: variable1=value1&variable2=value2&variable3=value3

    So, once the buyer clicks "Checkout", the info is sent to the gateway, but how do I read the response?

    Any insight would be greatly appreciated. (My wife bakes great cookies).

  • #2
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    take a look at the Zend framework's Http_Client, makes stuff like this really easy:
    http://framework.zend.com/manual/en/zend.http.html
    My thoughts on some things: http://codemeetsmusic.com
    And my scrapbook of cool things: http://gjones.tumblr.com

  • #3
    Registered User
    Join Date
    Jan 2008
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks GJay, I'll take a look.

    But, in doing a little research it seems like this could be done fairly easily with cUrl.

    Any thoughts?

  • #4
    Regular Coder
    Join Date
    Aug 2002
    Location
    Oregon, United States of America
    Posts
    882
    Thanks
    1
    Thanked 9 Times in 9 Posts
    Yes, you should be using curl for this, though you can use list() to break apart the string if you really want to do it that way.
    If I'm postin here, I NEED YOUR HELP!!

  • #5
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    PHP Code:
    <?php
    $ch 
    curl_init();
    curl_setopt($chCURLOPT_URL"http://www.example.com/");
    curl_setopt($chCURLOPT_HEADER0);
    curl_exec($ch);
    curl_close($ch);
    vs.
    PHP Code:
    $client = new Zend_Http_Client('http://www.example.com');
    $response $client->request();
    echo 
    $response->getBody(); 
    I know which one I'm more likely to understand in 6 months time, but in the simple case there isn't a lot in it.
    My thoughts on some things: http://codemeetsmusic.com
    And my scrapbook of cool things: http://gjones.tumblr.com

  • #6
    Senior Coder
    Join Date
    Mar 2003
    Location
    Atlanta
    Posts
    1,037
    Thanks
    14
    Thanked 30 Times in 28 Posts
    I went from using cURL to SOAP to Zend. I'd recommend using Zend as well if you can. Don't be inimidated by the framework.
    Most of my questions/posts are fairly straightforward and simple. I post long verbose messages in an attempt to be thorough.

  • #7
    Registered User
    Join Date
    Jan 2008
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanx for the thoughts, guys. I'll checkout Zend.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •