title: paypal ipn won't return item_name and quantity
body: <p>I am trying to make an online shopping with my custom shopping cart.</p>
  
  <p>Here's the code in HTML:</p>
  
  <pre><code>&lt;form name="paypalSubmit" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="POST"&gt;
      &lt;input type="hidden" name="cmd" value="_cart"&gt;
      &lt;input type="hidden" name="upload" value="1"&gt;
      &lt;input type="hidden" name="business" value="value"&gt;
      &lt;input type="hidden" name="currency_code" value="EUR"&gt;
      &lt;input type="hidden" name="cancel_return" value="link"&gt;
      &lt;input type="hidden" name="return" value="link"&gt;
  
                  &lt;input type="hidden" name="item_name_1" value='Stiklines is ledo'&gt;
              &lt;input type="hidden" name="amount_1" value=0.56&gt;
              &lt;input type="hidden" name="quantity1" value=3&gt;
  
                         &lt;input type="hidden" name="item_name_2" value='RGB lempute su pultu'&gt;
              &lt;input type="hidden" name="amount_2" value=0.68&gt;
              &lt;input type="hidden" name="quantity2" value=1&gt;
  
  
      &lt;input type="image" src="http://www.paypal.com/en_US/i/btn/x-click-but01.gif" name="submit" alt="Make payments with PayPal - it's fast, free and secure!"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Everything works fine. After the payment is complete, ipn hits my ipn_listener which then updates database. Although it won't return <code>item_name</code> nor <code>quantity</code>. Thus it returns <code>payment_status</code>, <code>mc_gross</code>, <code>mc_currency</code>, <code>txn_id</code>, <code>payer_email</code>, <code>payment_date</code>.</p>
  
  <p>Anyone can help me figure out what am I missing? Thank You very much.</p>
  
  <p>EDIT:
  ipn_listener.php</p>
  
  <pre><code>&lt;?php
  require_once("dbcontroller.php");
  $db_handle = new DBController();
  // STEP 1: Read POST data
  
  // reading posted data from directly from $_POST causes serialization 
  // issues with array data in POST
  // reading raw POST data from input stream instead. 
  $raw_post_data = file_get_contents('php://input');
  $raw_post_array = explode('&amp;', $raw_post_data);
  $myPost = array();
  foreach ($raw_post_array as $keyval) {
    $keyval = explode ('=', $keyval);
    if (count($keyval) == 2)
       $myPost[$keyval[0]] = urldecode($keyval[1]);
  }
  // read the post from PayPal system and add 'cmd'
  $req = 'cmd=_notify-validate';
  if(function_exists('get_magic_quotes_gpc')) {
     $get_magic_quotes_exists = true;
  } 
  foreach ($myPost as $key =&gt; $value) {        
     if($get_magic_quotes_exists == true &amp;&amp; get_magic_quotes_gpc() == 1) { 
          $value = urlencode(stripslashes($value)); 
     } else {
          $value = urlencode($value);
     }
     $req .= "&amp;$key=$value";
  }
  
  
  // STEP 2: Post IPN data back to paypal to validate
  
  $ch = curl_init('https://www.sandbox.paypal.com/cgi-bin/webscr');
  curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
  curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
  curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: Close'));
  
  // In wamp like environments that do not come bundled with root authority certificates,
  // please download 'cacert.pem' from "http://curl.haxx.se/docs/caextract.html" and set the directory path 
  // of the certificate as shown below.
  // curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__) . '/cacert.pem');
  if( !($res = curl_exec($ch)) ) {
      // error_log("Got " . curl_error($ch) . " when processing IPN data");
      curl_close($ch);
      exit;
  }
  curl_close($ch);
  
  
  // STEP 3: Inspect IPN validation result and act accordingly
  
  if (strcmp ($res, "VERIFIED") == 0) {
      // check whether the payment_status is Completed
      // check that txn_id has not been previously processed
      // check that receiver_email is your Primary PayPal email
      // check that payment_amount/payment_currency are correct
      // process payment
  
      // assign posted variables to local variables
      $item_name = $_POST['item_name'];
      $item_quantity = $_POST['quantity'];
      $payment_status = $_POST['payment_status'];
      $payment_amount = $_POST['mc_gross'];
      $payment_currency = $_POST['mc_currency'];
      $txn_id = $_POST['txn_id'];
      $payer_email = $_POST['payer_email'];
      $payment_date = $_POST['payment_date'];
  
      // &lt;---- HERE you can do your INSERT to the database    
      $db_handle-&gt;insert("INSERT INTO buy_history(payment_method, item_name, item_quantity, payment_status, payment_amount, payment_currency, txn_id, payer_email, payment_date) VALUES ('paypal', '" . $item_name . "', " . $item_quantity . ", '" . $payment_status . "', '" . $payment_amount . "', '" . $payment_currency . "', '" . $txn_id . "', '" . $payer_email . "', '" . $payment_date . "')");
  
  
  } else if (strcmp ($res, "INVALID") == 0) {
  
  }
  ?&gt;
  </code></pre>