title: Not receiving a response from Paypal IPN Sandbox
body: <p>I'm putting a paypal checkout onto my website but am falling down with the listener.
  For those of you who are unfamiliar with the Paypal IPN system, basically Paypal sends your script with a message about the transaction, which you send back with a couple of bits added. If Paypal receives the correct reply, it'll reply with 'VERIFIED', and if not it'll say 'INVALID'.</p>
  
  <p>I've succeeded with the first bit. My code is able to receive the info from paypal, add on the extras and post it back. However, I get no response from the Sandbox saying either 'VERIFIED' or 'INVALID'. I've pretty much copied my code from the paypal website so I was hoping this was going to be fairly straightforward, so if you could take a minute to look at my code, perhaps some new eyes could pick out where I've gone wrong.</p>
  
  <p>Here's the code. Nothing special, it literally just gets the info, adjusts it, passes it back and reads the response (which it either isn't getting or doesn't realise it's getting)</p>
  
  <pre><code>&lt;?php
  
  $debug=true;
  
  //Put together postback info
  
  $postback = 'cmd=_notify-validate';
  
  foreach($_POST as $key =&gt;$value){
       $postback .= "&amp;$key=$value";
  }
  
  // build the header string to post back to PayPal system to validate
  $header = "POST /cgi-bin/webscr HTTP/1.1\r\n";
  $header .= "Host: www.sandbox.paypal.com\r\n";
  $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
  $header .= "Content-Length: " . strlen($postback) . "\r\n\r\n";
  
  $fp = fsockopen ('www.sandbox.paypal.com', 80, $errno, $errstr, 30);//open the connection
  
  if(!$fp){ //no conn
      die();
  }
  
  //post data back
  fputs($fp, $header . $postback);
  
  while(!feof($fp)){
  
      $res=fgets ($fp, 1024);
  
      if((strcmp($res, "VERIFIED")) == 0){ //verified!
          if($debug){         
              $filename = 'debug/debug5_verified.txt'; //create a file telling me we're verified
              $filehandle=fopen($filename, 'w');
              fwrite($filehandle,'VERIFIED!');
              fclose($filehandle);
          }
      }
  }
  
  ?&gt;
  </code></pre>
  
  <p>Thanks in advance!</p>