View Single Post
  #9  
Old 11th March 2013, 11:29
vaio1 vaio1 is offline
Senior Member
 
Join Date: Jul 2007
Location: Italy
Posts: 664
Thanks: 77
Thanked 12 Times in 7 Posts
Default

Hi Till,

this is a snipped of code to test the ssl connection to Paypal:

Code:
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

try{
    $arrData = array(
        'tx'    => '----',
        'cmd'   => '_notify-synch',
        'at'    => '-----'
    );

    $ch = curl_init( 'https://api-3t.sandbox.paypal.com/nvp' );

	curl_setopt($ch, CURLOPT_HEADER, true); // Display headers
	curl_setopt($ch, CURLOPT_VERBOSE, true); // Display communication with server
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Return data instead of display to std out

	curl_setopt($ch, CURLOPT_POST, 1);

	curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,0);
	curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,0);

	curl_setopt($ch, CURLOPT_POSTFIELDS, $arrData);
	$strCurlResult = curl_exec($ch);
    
    
	print "<pre>\n";
	print_r(curl_getinfo($ch));  // get error info
	echo "\n\ncURL error number:" .curl_errno($ch); // print error info
	echo "\n\ncURL error:" . curl_error($ch); 
	print "</pre>\n";
    
    curl_close( $ch );
    print_r($strCurlResult);
}catch(Exception $e){
    echo $e->getMessage();
}


?>
this is a php test result:

Code:
Array
(
    [url] => https://api-3t.sandbox.paypal.com/nvp
    [content_type] => 
    [http_code] => 0
    [header_size] => 0
    [request_size] => 0
    [filetime] => -1
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 21.016503
    [namelookup_time] => 0.018763
    [connect_time] => 0
    [pretransfer_time] => 0
    [size_upload] => 0
    [size_download] => 0
    [speed_download] => 0
    [speed_upload] => 0
    [download_content_length] => -1
    [upload_content_length] => -1
    [starttransfer_time] => 0
    [redirect_time] => 0
    [certinfo] => Array
        (
        )

)


cURL error number:7
cURL error:couldn't connect to host
Reply With Quote