title: Trouble verifying paypal notify data with PHP
body: <p>I'm trying to check the data that paypal sends to my notify_url after a transaction has been paid (in this case using the sandbox).</p>
  
  <p>I've tried the sample code from paypal with fsockopen but I just couldn't get it to work properly. I also tried with cURL by manually giving a certificate, but it didn't turn out well either.</p>
  
  <p>However after some changes, I managed to find a solution :</p>
  
  <pre><code>&lt;?php
  $_POST = array('mc_gross' =&gt; '9.90',
  'protection_eligibility' =&gt; 'Eligible',
  'address_status' =&gt; 'confirmed',
  'payer_id' =&gt; '5PK5H93BE5RAQ',
  'tax' =&gt; '0.00',
  'address_street' =&gt; '1 Main St',
  'payment_date' =&gt; '12:13:29 Jan 12, 2012 PST',
  'payment_status' =&gt; 'Pending',
  'charset' =&gt; 'windows-1252',
  'address_zip' =&gt; '95131',
  'first_name' =&gt; 'Test',
  'address_country_code' =&gt; 'US',
  'address_name' =&gt; 'Test User',
  'notify_version' =&gt; '3.4',
  'custom' =&gt; '523368657',
  'payer_status' =&gt; 'verified',
  'business' =&gt; 'seller_1326059109_biz@yahoo.fr',
  'address_country' =&gt; 'United States',
  'address_city' =&gt; 'San Jose',
  'quantity' =&gt; '1',
  'verify_sign' =&gt; 'AGilT0jx3itxd3XAujXRvUPipg93ATqSM88ML-PAwAoa7xGkRSWXhVR8',
  'payer_email' =&gt; 'buyer_1326398444_per@yahoo.fr',
  'txn_id' =&gt; '1C254380JG793833D',
  'payment_type' =&gt; 'instant',
  'last_name' =&gt; 'User',
  'address_state' =&gt; 'CA',
  'receiver_email' =&gt; 'seller_1326059109_biz@yahoo.fr',
  'receiver_id' =&gt; 'FKBDH7FDLECEQ',
  'pending_reason' =&gt; 'multi_currency',
  'txn_type' =&gt; 'web_accept',
  'item_name' =&gt; 'Compte premium winker',
  'mc_currency' =&gt; 'EUR',
  'item_number' =&gt; '',
  'residence_country' =&gt; 'US',
  'test_ipn' =&gt; '1',
  'handling_amount' =&gt; '0.00',
  'transaction_subject' =&gt; '523368657',
  'payment_gross' =&gt; '',
  'shipping' =&gt; '0.00',
  'ipn_track_id' =&gt; '1v3OWX6MBMqE6Oe6-BSmCA');
  $req = '?cmd=_notify-validate';
  foreach ($_POST as $key =&gt; $value) {
    $value = urlencode(stripslashes($value));
    $req .= "&amp;amp;$key=$value";
  }
  
  $url = 'https://sandbox.paypal.com/cgi-bin/webscr'.$req;
  echo '&lt;p&gt;&lt;a href="'.$url.'" target="_blank"&gt;browse link&lt;/a&gt;&lt;/p&gt;';
  
  $content = file_get_contents($url);
  var_dump($content);
  </code></pre>
  
  <p>I do get a result but it is "INVALID", whereas if I open the link on my browser (with the exact same informations), it is "VERIFIED" !</p>
  
  <p>Any ideas ?</p>
  
  <p>Thanks in advance for your replies</p>