using PHP curl and a client cert
| From: | Scott | Date: | Thu, 04 Sep 2003 04:18:39 +0000 |
| Subject: | using PHP curl and a client cert | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-161719@lists.php.net to get a copy of this message | ||
Hello,
I am trying to post to a ste that requires me to use a client cert. I can
get it to work for both windows and unix, but only on the command line. I
have tried without success to use the PHP built-in methods for doing this.
Here is the command line that works:
curl -d "<REQUEST_GROUP MISMOVersionID='2.1'> <REQUESTING_PARTY>
<PREFERRED_RESPONSE _Format='XML' /> </REQUESTING_PARTY> <REQUEST
LoginAccountIdentifier='12345' LoginAccountPassword='pass'>
<REQUEST_DATA>
<CREDIT_REQUEST MISMOVersionID='2.1'> <CREDIT_REQUEST_DATA
CreditRequestType='Individual'> <CREDIT_REPOSITORY_INCLUDED
_EquifaxIndicator='Y' _ExperianIndicator='Y'
_TransUnionIndicator='Y'/>
</CREDIT_REQUEST_DATA> <LOAN_APPLICATION> <BORROWER
_FirstName='BOBBY' _LastName='BANKRUPT' _PrintPositionType='Borrower'
_SSN='000546327'> <_RESIDENCE _City='PRESCOTT' _State='AZ'
_PostalCode='86305' BorrowerResidencyType='Current'>
<PARSED_STREET_ADDRESS _AddressType='NormalAddress' _HouseNumber='1003'
_StreetName='Enred Way' /> </_RESIDENCE> </BORROWER>
</LOAN_APPLICATION> </CREDIT_REQUEST> </REQUEST_DATA>
</REQUEST></REQUEST_GROUP>" -k -E myCert.pem:myPassword
https://www.mysite.com/Listener.exe
Any ideas of how to make this work with the curl_setopt methods? I tried
variations of this:
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 2);
curl_setopt ($ch, CURLOPT_SSLKEY, 'myCert.pem');
curl_setopt ($ch, CURLOPT_SSLKEYPASSWD, 'myPassword');
$result = curl_exec ($ch);
Thanks,
Scott