Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

curl command line to PHP curl

Tags:

php

curl

paypal

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.

like image 938
fishcracker Avatar asked May 18 '26 16:05

fishcracker


1 Answers

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.

like image 200
Floris Avatar answered May 22 '26 00:05

Floris



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!