如何模拟火狐取得https的网页内容?

wongsieung 2015-04-20 03:45:40
我从电子支付商那个取得一个p12证书文档,我必须要将这个证书文档载入火狐才能正确的获取https的wdsl文件。以下是我把文档载入火狐的步骤:
步骤1:



步骤2:



步骤3:



步骤4:



步骤5:



那么现在我想使用phpcurl来模拟火狐去截取https的wdsl文档,以下是我尝试过的代码,可是都是错误的,请大家指教:

个案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');


个案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');


到此,我尝试使用openssl指令把证书和密钥抽取出来
openssl pkcs12 -in yourP12File.pfx -nocerts -out privateKey.pem
openssl pkcs12 -in yourP12File.pfx -clcerts -nokeys -out publicCert.pem
个案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");


个案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");
...全文
190 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
wongsieung 2015-04-21
  • 打赏
  • 举报
回复
有哪位能人可以解答鄙人的疑惑吗 ? 我在很多其他西方国家的著名编程论坛贴了都没有得到解答。
猪崽儿0o0 2015-04-20
  • 打赏
  • 举报
回复
我第一次听说wsdl文件是这么用得。
风钢我 2015-04-20
  • 打赏
  • 举报
回复
看起来很难的样子。

21,892

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧