Last active
April 9, 2018 22:42
-
-
Save mrw/514cf8bfb3085bafb713 to your computer and use it in GitHub Desktop.
PHP PayPal new certificate test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
File prepared by Matt Weinberg, www.vectormediagroup.com and www.cartthrob.com | |
EXPLANATION: | |
In 2018, PayPal will be updating their Live/Production environment. | |
Many servers, especially older ones, will not be able to connect to PayPal after the settings are changed. | |
You can test your server by switching your CartThrob installation to PayPal's sandbox environment and going | |
through the checkout. You can also run the script below. | |
INSTRUCTIONS: | |
Place this file in your website root and go to it in a browser. The output will tell you if you should expect | |
to have a problem or not. | |
If you will have a problem, the output will provide resources for fixing it. | |
PLEASE NOTE THAT NO UPDATE TO CARTTHROB OR OTHER CART SOFTWARE CAN FIX SERVERS WITH ERRORS. YOUR SERVER MUST UPDATE | |
ITS PHP CURL SETTINGS TO BE COMPATIBLE. | |
More information from PayPal can be found here: | |
https://www.paypal-knowledge.com/infocenter/index?page=content&widgetview=true&id=FAQ1766&viewlocale=en_US&direct=en | |
*/ | |
$ch = curl_init("https://api-3t.paypal.com/nvp"); | |
curl_setopt($ch, CURLOPT_HEADER, 0); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
$connect = curl_exec($ch); | |
if (!$connect) { | |
echo "FAILURE: Your site will not be able to connect to PayPal after June 17th, 2016. Please contact your host and tell them to \"update PHP's cURL so it can successfully connect to https://api-3t.paypal.com/nvp\"." . PHP_EOL . PHP_EOL . "They can find more information here: https://www.paypal.com/au/webapps/mpp/tls-http-upgrade. " . PHP_EOL . PHP_EOL . "The exact error is:" . PHP_EOL; | |
print_r(curl_error($ch)); | |
} else { | |
echo "SUCCESS: You should be able to connect to PayPal."; | |
} | |
curl_close($ch); | |
exit(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment