I got a p12 file from one payment service, only by using this file i can load wsdl from the https address they provide to me. Below are steps how i import the p12 file to my browser to load the wdsl file. So i import the p12 to my firefox then the wdsl file load successfully.
The below steps are how i do in Firefox. Step 1: Step 2: Step 3: Step 4: Step 5:
So now, i want to use PHP Curl to mimic the firefox browser to load the https wdsl content, I have try the followong code but failed, Please advice me.
I try the below code but all failed.
Case 1: Unable to load client cert -8018. - $client = curl_init();
-
curl_setopt($client, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)');
-
curl_setopt($client, CURLOPT_URL, $address);
-
curl_setopt($client, CURLOPT_CONNECTTIMEOUT, 150);
-
curl_setopt($client, CURLOPT_TIMEOUT, 150);
-
curl_setopt($client, CURLOPT_RETURNTRANSFER, true );
-
curl_setopt($client, CURLOPT_POST, true );
-
curl_setopt($client, CURLOPT_VERBOSE, true );
-
curl_setopt($client, CURLOPT_SSL_VERIFYPEER, false);
-
curl_setopt($client, CURLOPT_SSL_VERIFYHOST, false);
-
curl_setopt($client, CURLOPT_SSLCERT, getcwd().'/latest_key/willaniclienttest.p12');//willaniclienttest.p12
-
curl_setopt($client, CURLOPT_SSLCERTTYPE, 'P12');
-
curl_setopt($client, CURLOPT_SSLCERTPASSWD, 'willanitest');
-
Case 2: //Unable to load client cert -8018. - $client = curl_init();
-
curl_setopt($client, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)');
-
curl_setopt($client, CURLOPT_URL, $address);
-
curl_setopt($client, CURLOPT_CONNECTTIMEOUT, 150);
-
curl_setopt($client, CURLOPT_TIMEOUT, 150);
-
curl_setopt($client, CURLOPT_RETURNTRANSFER, true );
-
curl_setopt($client, CURLOPT_POST, true );
-
curl_setopt($client, CURLOPT_VERBOSE, true );
-
curl_setopt($client, CURLOPT_SSL_VERIFYPEER, true);
-
curl_setopt($client, CURLOPT_SSL_VERIFYHOST, 2);
-
curl_setopt($client, CURLOPT_CAINFO, getcwd().'/latest_key/cacert.pem'); // cacert.pem
-
curl_setopt($client, CURLOPT_SSLCERT, getcwd().'/latest_key/willaniclienttest.p12');//willaniclienttest.p12
-
curl_setopt($client, CURLOPT_SSLCERTTYPE, 'P12');
-
curl_setopt($client, CURLOPT_SSLCERTPASSWD, 'willanitest');
Now i extract the private key and public cert by using the below command:
openssl pkcs12 -in yourP12File.pfx -nocerts -out privateKey.pem
openssl pkcs12 -in yourP12File.pfx -clcerts -nokeys -out publicCert.pem
Case 3: Peer certificate cannot be authenticated with known CA certificates - $client = curl_init();
-
curl_setopt($client, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)');
-
curl_setopt($client, CURLOPT_URL, $address);
-
curl_setopt($client, CURLOPT_CONNECTTIMEOUT, 150);
-
curl_setopt($client, CURLOPT_TIMEOUT, 150);
-
curl_setopt($client, CURLOPT_RETURNTRANSFER, true );
-
curl_setopt($client, CURLOPT_POST, true );
-
curl_setopt($client, CURLOPT_VERBOSE, true );
-
curl_setopt($client, CURLOPT_SSL_VERIFYPEER, true);
-
curl_setopt($client, CURLOPT_SSL_VERIFYHOST, 2);
-
curl_setopt($client, CURLOPT_CAINFO, getcwd().'/latest_key/cacert.pem'); // cacert.pem
-
curl_setopt($ch, CURLOPT_SSLCERT, getcwd().'/latest_key/publicCert.pem'); //
-
curl_setopt($ch, CURLOPT_SSLCERTPASSWD, "epay123");
-
curl_setopt($ch, CURLOPT_SSLKEY, getcwd().'/latest_key/privateKey.pem');
-
curl_setopt($ch, CURLOPT_SSLKEYPASSWD, "epay123");
Case 4: NSS: client certificate not found (nickname not specified) - $client = curl_init();
-
curl_setopt($client, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)');
-
curl_setopt($client, CURLOPT_URL, $address);
-
curl_setopt($client, CURLOPT_CONNECTTIMEOUT, 150);
-
curl_setopt($client, CURLOPT_TIMEOUT, 150);
-
curl_setopt($client, CURLOPT_RETURNTRANSFER, true );
-
curl_setopt($client, CURLOPT_POST, true );
-
curl_setopt($client, CURLOPT_VERBOSE, true );
-
curl_setopt($client, CURLOPT_SSL_VERIFYPEER, false);
-
curl_setopt($client, CURLOPT_SSL_VERIFYHOST, false);
-
curl_setopt($ch, CURLOPT_SSLCERT, getcwd().'/latest_key/publicCert.pem'); //
-
curl_setopt($ch, CURLOPT_SSLCERTPASSWD, "epay123");
-
curl_setopt($ch, CURLOPT_SSLKEY, getcwd().'/latest_key/privateKey.pem');
-
curl_setopt($ch, CURLOPT_SSLKEYPASSWD, "epay123");
-
0 1632 Sign in to post your reply or Sign up for a free account.
Similar topics
by: Hans |
last post by:
Hi everybody,
I am desperately trying to log into my account at godaddy.com with PHP
and Curl and just cannot make it happen. Has anybody written a script
for this purpose?
Here is what I...
|
by: Russ Wickstrom |
last post by:
I have a webpage (http://www.clergytaxes.com/taxwarn.html) that looks fine
in IE but isn't applying any of the style in Firefox.
I am still in the process of converting this site to a stylesheet...
|
by: Scott Orsburn |
last post by:
Is there a way to load the contents returned from a URL into a
JavaScript variable? Suppose a user picks an option from a popup list.
I want to pass that choice in a URL to a script on a server...
|
by: vandenberc |
last post by:
I am trying to setup an html page. I have a button and when you click
on it I want it to go to either http:///.../demo.htm or
https://..../demo.htm based on whether or not you went through the...
|
by: nfhm2k |
last post by:
I've been trying to find a solution to this for quite some time now...
I even took a look at existing scripts...
Including this one......
|
by: laramie.hartmann |
last post by:
I have a script (see below) that accesses a XML file and displays the
contents through a series of document.write calls. This all works fine
in IE, but not at all in Firefox. I get no errors in the...
|
by: David Trimboli |
last post by:
Suppose I've got HTML with the following in it:
<ul class="navigation">
<li><a href="chapter1.html" title="Chapter 1">Previous</a></li>
<li><a href="./">Contents</a></li>
<li><a...
|
by: Aggelos |
last post by:
Hello everyone,
I am trying to emulate sort of a Payment Gateway.
A user makes an order and then when he checks out he gets transfered
to the HTTPS page to enter his details.
At the moment I am...
|
by: Paul van Brouwershaven |
last post by:
I have some problems with the curl. On the console I get the right
response message but in PHP I see no difference between a valid and an
invalid SSL Certificate.
Curl command in PHP:
$url =...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
| |