cancel
Showing results for 
Search instead for 
Did you mean: 

response is not coming for my return url

Options
znv51powt
Contributor

 

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);

response is not coming for my return url

Options
znv51powt
Contributor

Testing:

<?
$options = array(
CURLOPT_RETURNTRANSFER => true, // return web page
CURLOPT_HEADER => false, // don't return headers
CURLOPT_FOLLOWLOCATION => true, // follow redirects
CURLOPT_ENCODING => "", // handle all encodings
CURLOPT_USERAGENT => "spider", // who am i
CURLOPT_AUTOREFERER => true, // set referer on redirect
CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect
CURLOPT_TIMEOUT => 120, // timeout on response
CURLOPT_MAXREDIRS => 10, // stop after 10 redirects
CURLOPT_SSL_VERIFYPEER => false // Disabled SSL Cert checks
);

$ch
= curl_init( 'https://pay4links.com/pay-pal/ipn' );
curl_setopt_array( $ch, $options );
$content = curl_exec( $ch );
$err = curl_errno( $ch );
$errmsg = curl_error( $ch );
$header = curl_getinfo( $ch );
curl_close( $ch );

$header['errno'] = $err;
$header['errmsg'] = $errmsg;
$header['content'] = $content;
var_dump($header);

Result:

array(29) { ["url"]=> string(33) "https://pay4links.com/pay-pal/ipn" ["content_type"]=> string(24) "text/html; charset=UTF-8" ["http_code"]=> int(200) ["header_size"]=> int(187) ["request_size"]=> int(115) ["filetime"]=> int(-1) ["ssl_verify_result"]=> int(0) ["redirect_count"]=> int(0) ["total_time"]=> float(1.518264) ["namelookup_time"]=> float(0.060373) ["connect_time"]=> float(0.081262) ["pretransfer_time"]=> float(0.199968) ["size_upload"]=> float(0) ["size_download"]=> float(0) ["speed_download"]=> float(0) ["speed_upload"]=> float(0) ["download_content_length"]=> float(0) ["upload_content_length"]=> float(0) ["starttransfer_time"]=> float(1.51824) ["redirect_time"]=> float(0) ["redirect_url"]=> string(0) "" ["primary_ip"]=> string(13) "88.208.35.227" ["certinfo"]=> array(0) { } ["primary_port"]=> int(443) ["local_ip"]=> string(15) "149.202.210.177" ["local_port"]=> int(43829) ["errno"]=> int(0) ["errmsg"]=> string(0) "" ["content"]=> string(0) "" }

 

response is not coming for my return url

Options
MTS_Ciaran
PayPal Employee

So for that IPN handler (https://pay4links.com/pay-pal/ipn) I was able to get a successful IPN sent using the IPN simulator here:

https://developer.paypal.com/developer/ipnSimulator/

 

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.