title: IPN Verification Postback to HTTPS
body: <p>My PHP code currently uses the following to Postback to PayPal. How do I update this to meet the new payment security standards coming into effect?</p>
  
  <pre><code>$req = 'cmd=_notify-validate';
  
  foreach ($_POST as $key =&gt; $value) 
  {
    $value = urlencode(stripslashes($value));
    $req .= "&amp;$key=$value";
  }
  // 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, $errstr, 30);
  
  if (!$fp) 
  {
    //an error occurred...
  } 
  
  else 
  {
    fputs ($fp, $header . $req);
  
    while (!feof($fp)) 
    {
      $res = fgets ($fp, 1024);
  
      if(strcmp ($res, "VERIFIED") == 0) 
      {
        //all is well...
      }
    }
  }
  </code></pre>