Code of https://pay4links.com/pay-pal/ipn is: $postStr = file_get_contents('php://input'); header("HTTP/1.1 200 OK"); $raw_post_array = explode('&', $postStr); $myPost = []; foreach ($raw_post_array as $keyval) { $keyval = explode('=', $keyval); if (count($keyval) == 2) { // Since we do not want the plus in the datetime string to be encoded to a space, we manually encode it. if ($keyval[0] === 'payment_date') { if (substr_count($keyval[1], '+') === 1) { $keyval[1] = str_replace('+', '%2B', $keyval[1]); } } $myPost[$keyval[0]] = urldecode($keyval[1]); } } // Build the body of the verification post request, adding the _notify-validate command. $req = 'cmd=_notify-validate'; foreach ($myPost as $key => $value) { $req .= "&$key=" . urlencode($value); } $curl = curl_init('https://www.sandbox.paypal.com/cgi-bin/webscr'); curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $req); curl_setopt($curl, CURLOPT_SSLVERSION, 6); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 1); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($curl, CURLOPT_FORBID_REUSE, 1); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 30); curl_setopt($curl, CURLOPT_HTTPHEADER, ['Connection: Close']); $res = curl_exec($curl); $info = curl_getinfo($curl); curl_close($curl);
... View more