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 5 of 5
  1. #1
    Senior Coder nikos101's Avatar
    Join Date
    Dec 2006
    Location
    London
    Posts
    1,007
    Thanks
    59
    Thanked 10 Times in 10 Posts

    why are PayPal using things like & in a post?

    I'm having a time trying to get my head round this Paypal PDT php code.

    the question I have is why are they using things like & in a post ($req .= "&tx=$tx_token&at=$auth_token"

    PHP Code:
    <?php
    // read the post from PayPal system and add 'cmd'
    $req 'cmd=_notify-synch';

    $tx_token $_GET['tx'];
    $auth_token "GX_sTf5bW3wxRfFEbgofs88nQxvMQ7nsI8m21rzNESnl_79ccFTWj2aPgQ0";
    $req .= "&tx=$tx_token&at=$auth_token";

    // post back to PayPal system to validate
    $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
    $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
    $header .= "Content-Length: " strlen($req) . "\r\n\r\n";
    $fp fsockopen ('www.paypal.com'80$errno$errstr30);
    // If possible, securely post back to paypal using HTTPS
    // Your PHP server will need to be SSL enabled
    // $fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);


  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,861
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Simply passing parameters and their values through the query string. & is used to concatenate multiple parameters.
    Last edited by abduraooft; 03-01-2008 at 10:04 AM.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Senior Coder nikos101's Avatar
    Join Date
    Dec 2006
    Location
    London
    Posts
    1,007
    Thanks
    59
    Thanked 10 Times in 10 Posts
    Ah cool, also I see they didn't use $ to reference a parameter.


  • #4
    New Coder
    Join Date
    Mar 2008
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Why would they?
    The $variable would be set in their server side code.

  • #5
    Regular Coder
    Join Date
    Aug 2006
    Location
    UK, London, Dartford
    Posts
    221
    Thanks
    3
    Thanked 14 Times in 14 Posts
    For that part of code i use:
    PHP Code:
    foreach ($_POST as $key => $value) {
        
    $value urlencode(stripslashes($value));
        
    $req .= "&$key=$value";



  •  

    Posting Permissions

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