Anchio ho avuto problemi con altervista e fsockopen.
prova ad usare il curl:
else{
// Response from Paypal
$ch = curl_init(); // Starts the curl handler
$url = "https://www.paypal.com/cgi-bin/webscr";
curl_setopt($ch, CURLOPT_URL,$url); // Sets the paypal address for curl
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // Returns result to a variable instead of echoing
curl_setopt($ch, CURLOPT_TIMEOUT, 3); // Sets a time limit for curl in seconds (do not set too low)
curl_setopt($ch, CURLOPT_POST, 1); // Set curl to send data using post
curl_setopt($ch, CURLOPT_POSTFIELDS, $req); // Add the request parameters to the post
$result = curl_exec($ch); // run the curl process (and return the result to $result
curl_close($ch);
//$subject = "$add Problema IPN1";
//$message = "Si è verificato un problema nella seguente transazione:\r\n\r\n";
//$message .="Result". $result ." --REQ ". $req;
//mail(ADMIN_MAIL,$subject,$message,"From: noreply<$from>");
if (strcmp ($result, "VERIFIED") == 0) // It may seem strange but this function returns 0 if the result matches the string So you MUST check it is 0 and not just do strcmp ($result, "VERIFIED") (the if will fail as it will equate the result as false)
{
return TRUE;
}
else
{ $this->sendReport();
return FALSE;
}
}
$req = 'cmd=_notify-validate';
// Run through the posted array
foreach ($_POST as $key => $value)
{
$req = 'cmd=_notify-validate';
foreach ($_POST as $key => $value)
{
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}
}
E' probabile che lo devi adattare un po al tuo caso specifico, prova e fammi sapere