fishcracker
fishcracker

Reputation: 2519

curl command line to PHP curl

How do I translate this commandline PayPal cURL request --insecure

curl -s --insecure 
-H "X-PAYPAL-SECURITY-USERID: api_username" 
-H "X-PAYPAL-SECURITY-PASSWORD: api_password" 
-H "X-PAYPAL-SECURITY-SIGNATURE: api_signature" 
-H "X-PAYPAL-REQUEST-DATA-FORMAT: NV" 
-H "X-PAYPAL-RESPONSE-DATA-FORMAT: NV" 
-H "X-PAYPAL-APPLICATION-ID: app_id"

I know I will place -H values to:

curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-PAYPAL-SECURITY-USERID: api_username', 'X-PAYPAL-SECURITY-PASSWORD: api_password'));

But I am not sure with the --insecure.

Upvotes: 3

Views: 2154

Answers (1)

Floris
Floris

Reputation: 46435

From http://curl.haxx.se/docs/manpage.html :

-k, --insecure: (SSL) This option explicitly allows curl to perform "insecure" SSL connections and transfers. All SSL connections are attempted to be made secure by using the CA certificate bundle installed by default. This makes all connections considered "insecure" fail unless -k, --insecure is used.

Looking further at reading SSL page with CURL (php), this tells you that you have to set CURLOPT_SSL_VERIFYPEER and CURLOPT_SSL_VERIFYHOST to FALSE. This basically overrides the "security checks".

I think that's what you need to mirror the --insecure command line option.

Upvotes: 3

Related Questions