note 84374 added to function.curl-setopt

From: Date: Thu, 10 Jul 2008 17:08:48 +0000
Subject: note 84374 added to function.curl-setopt
Groups: php.notes 
Request: Send a blank email to php-notes+get-141381@lists.php.net to get a copy of this message
If you want to connect to a server which requires that you identify yourself with a certificate, use following code. Your certificate and servers certificate are signed by an authority whose certificate is in ca.ctr. <?php curl_setopt($ch, CURLOPT_VERBOSE, '1'); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, '1'); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, '1'); curl_setopt($ch, CURLOPT_CAINFO, getcwd().'/cert/ca.crt'); curl_setopt($ch, CURLOPT_SSLCERT, getcwd().'/cert/mycert.pem'); curl_setopt($ch, CURLOPT_SSLCERTPASSWD, 'password'); ?> If your original certificate is in .pfx format, you have to convert it to .pem using following commands # openssl pkcs12 -in mycert.pfx -out mycert.key # openssl rsa -in mycert.key -out mycert.pem # openssl x509 -in mycert.key >> mycert.pem ---- Server IP: 212.24.129.51 Probable Submitter: 213.250.198.38 ---- Manual Page -- http://www.php.net/manual/en/function.curl-setopt.php Edit -- https://master.php.net/note/edit/84374 Del: integrated -- https://master.php.net/note/delete/84374/integrated Del: useless -- https://master.php.net/note/delete/84374/useless Del: bad code -- https://master.php.net/note/delete/84374/bad+code Del: spam -- https://master.php.net/note/delete/84374/spam Del: non-english -- https://master.php.net/note/delete/84374/non-english Del: in docs -- https://master.php.net/note/delete/84374/in+docs Del: other reasons-- https://master.php.net/note/delete/84374 Reject -- https://master.php.net/note/reject/84374 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#141381) next »