I am trying to verify the paypal pdt information.
I generated my mockup form and submitted it. IT worked and returned the information too.
I tried the same thing making curl request. But my cur request is returning blank to me.
my mockup form:
<form method="post" action="https://sandbox.paypal.com/cgi-bin/webscr">
<input type="hidden" name="cmd" value="_notify-synch"/>
<input type="hidden" name="at" value="-----"/>
<input type="hidden" name="tx" value="-----"/>
<input type="submit" value="Test"/>
</form>
My CURL REQ Code:
$arrData = array(
'tx' => '----',
'cmd' => '_notify-synch',
'at' => '-----'
);
$ch = curl_init( 'https://sandbox.paypal.com/cgi-bin/webscr' );
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1) ;
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $arrData);
$strCurlResult = curl_exec($ch);
curl_close( $ch );
return $strCurlResult;
EDIT:
ON tracking curl error i found following message:
SSL: certificate subject name 'www.sandbox.paypal.com' does not match target host name 'sandbox.paypal.com'
Cause #1 – cURL is not enabled cURL is supported by your hosting company/plan but not enabled: If cURL is supported by you hosting company but it is not enabled by default, then often you simply just need to login to your hosting dashboard, navigate to the relevant section and enable it. Done!
The curl_setopt() function will set options for a CURL session identified by the ch parameter. The option parameter is the option you want to set, and the value is the value of the option given by the option. The value should be a long for the following options (specified in the option parameter):
CURLOPT_RETURNTRANSFER. true to return the transfer as a string of the return value of curl_exec() instead of outputting it directly.
In fact, you can just disable peer HOST verification. In some PHP/cURL version, just disabling PEER is not enough:
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
From the docs:
CURLOPT_SSL_VERIFYHOST: 1 to check the existence of a common name in the SSL peer certificate. 2 to check the existence of a common name and also verify that it matches the hostname provided. In production environments the value of this option should be kept at 2 (default value).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With