I'm trying to connect to Paypal Sandbox from a new server. If I test the code in my local computer (using XAMPP) it works fine. Also, if I test the code in my old server, it works ok too (same PHP version and libraries, and the new server should have the same configuration as the old (although I'm starting to doubt it...).
I redirect the CURL output to a file and this is what I get (similar output in curl_error()):
About to connect() to svcs.sandbox.paypal.com port 443 (#0) Trying 220.127.116.11... * Connection timed out couldn't connect to host Closing connection #0
This is the output of curl_getinfo():
[url] => https://svcs.sandbox.paypal.com/AdaptivePayments/Pay?actionType=PAY... [http_code] => 0 [header_size] => 0 [request_size] => 0 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 0 [namelookup_time] => 0.058702 [connect_time] => 0 [pretransfer_time] => 0 [size_upload] => 0 [size_download] => 0 [speed_download] => 0 [speed_upload] => 0 [download_content_length] => 0 [upload_content_length] => 0 [starttransfer_time] => 0 [redirect_time] => 0
This is the PHP code:
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $URL); curl_setopt($ch, CURLOPT_VERBOSE, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPHEADER , array( 'X-PAYPAL-SECURITY-USERID: '.$api_userid , 'X-PAYPAL-SECURITY-PASSWORD: '.$api_pass , 'X-PAYPAL-SECURITY-SIGNATURE: '.$api_signature , 'X-PAYPAL-APPLICATION-ID: '.$api_appid , 'X-PAYPAL-REQUEST-DATA-FORMAT: NV' , 'X-PAYPAL-RESPONSE-DATA-FORMAT: NV' ) ); $response = curl_exec($ch);
I think the problem points to a server configuration issue, but I'm a little lost in wich way I have to look: PHP configuration, Apache, firewall, ... ¿any ideas?