curl-and-php
curl client ssl certificate
Date: Tue, 14 Dec 2010 11:14:27 +0000
Hi,
I am facing some issues regarding the client certificate for php 5.2.x running on IIS 6. The same code works on linux machine running apache/php
$applicationPath=realpath(dirname(__FILE__));
$url = "https://<siteurl> ";
$clientcert = $applicationPath."/clientcertificate.pem";
$keyfile = $applicationPath."/userkey.pem";
$challenge = "XXXXXXXXXXX";
echo $clientcert.'<br>';
echo $keyfile.'<br>';
echo $challenge;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_SSLCERT, $clientcert);
curl_setopt($ch, CURLOPT_SSLCERTPASSWD, $challenge);
//curl_setopt($ch, CURLOPT_SSLKEYTYPE, 'PEM');
//curl_setopt($ch, CURLOPT_SSLKEY, $keyfile);
$ret = curl_exec($ch);
echo '<br /><br /><b>Xml Output</b>';
echo '<br /><br />';
echo htmlentities($ret).'<br /><br />';
if (curl_error($ch))
printf("Error %s: %s", curl_errno($ch), curl_error($ch));
curl_close($ch);
This is the response I get from Linux machine running php
Xml Output
<?xml version="1.0" encoding="UTF-8"?> <list> </list>
On Windows server the code fails for some reason and I get this error
Error 52: Empty reply from server*
What configuration changes do I need to make so that code runs on windows server.
Thanks,
Kailash
Kailash Vyas | Senior Programmer | DigForFireDMG
A communications agency with digital at its heart
Part of Digital Marketing Group PLC
No 1 UK Digital Agency in 2010 and 2009 (Campaign Magazine)
E kailash.vyas_at_digforfiredmg.co.uk www.digforfiredmg.co.uk
D +44 (0) 114 307 2007 | F +44 (0) 114 2810055
Players House, 300 Attercliffe Common, Sheffield S9 2AG
CIPR PRide Awards 2009 - Consumer relations GOLD
DADI Awards 2009 - Best public sector website or campaign WINNER
DigForFireDMG is a trading name of Scope Creative Marketing Limited.
A company registered in England and Wales with the company number 1677363 and VAT Number 308993032
Registered office is Arclite House, Century Road, Peatmoor, Swindon, SN5 5YN.
Please think before printing this email.
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php