I am trying IPN callback but everytime I try to validate the IPN message with paypal it says that is **INVALID**!
I already tried a lot of methods in the internet but anyone is working,
This is my code:

```
header('HTTP/1.1 200 OK');
$req = 'cmd=_notify-validate';
foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
$homepage = file_get_contents("https://ipnpb.sandbox.paypal.com/cgi-bin/webscr?{$req}");

```

This is working but its showing invalid.
Does someone knows why this is happening?