title: Paypal : trouble with ipn response
body: <p>I am uable to get the VERIFIED answer from paypal using the IPN
  I'm receiving the POST data from PayPal via the notify_url. I then send it back to PayPal with cmd=_notify-validate infront of the data.</p>
  
  <p>Using PayPals documented code, I'm using this to send the message to PayPal</p>
  
  <pre><code>$header = "POST /cgi-bin/webscr HTTP/1.1\r\n"; // HTTP POST request
  $header.= "Content-Type: application/x-www-form-urlencoded\r\n";
  $header.= "Host: www.sandbox.paypal.com\r\n";
  $header.= "Content-Length: " . strlen($req) . "\r\n";
  $header.= "Connection: Close\r\n\r\n";
  $fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30);
  </code></pre>
  
  <p>Then I use this</p>
  
  <pre><code>if (!$fp) {
      // HTTP ERROR; 
  } else {
      var_dump(fputs($fp, $header . $req));
      while (!feof($fp)) {
          $res = stream_get_contents($fp, 1024); 
          if (strcmp ($res, "VERIFIED") == 0) {
              //Transaction verified
          }
      }
  }
  </code></pre>
  
  <p>In fact I have two $res (due to the while loop). The first does not seems to be of interest and the second is</p>
  
  <pre><code>55 GMT
  Connection: close
  Set-Cookie: X-PP-SILOVER=name%3DSANDBOX3.WEB.1%26silo_version%3D880%26app%3Dslingshot%26TIME%3D1273590100; domain=.paypal.com; path=/; Secure; HttpOnly
  Set-Cookie: X-PP-SILOVER=; Expires=Thu, 01 Jan 1970 00:00:01 GMT
  Set-Cookie: Apache=10.72.128.11.1416751435364358; path=/; expires=Tue, 15-Nov-44 14:03:55 GMT
  Vary: Accept-Encoding
  Strict-Transport-Security: max-age=14400
  Transfer-Encoding: chunked
  Content-Type: text/html; charset=UTF-8
  
  8
  VERIFIED
  0
  </code></pre>
  
  <p>It seems that the first part is a header and the second part (8 VERIFIED 0) is the real response but why do I have this 0 and 8 ? Usually people use </p>
  
  <pre><code> if (strcmp ($res, "VERIFIED") == 0) {
  </code></pre>
  
  <p>To check that the $res is VERIFIED... So can I consider that the response is 'VERIFIED', using something like</p>
  
  <pre><code>if(strstr($res,'VERIFIED')) {
  </code></pre>
  
  <p>Some help please ?!?</p>
  
  <p>Thanks</p>