Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/289.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
cURL命令行到PHP_Php_Curl_Ssl Certificate_Ssl - Fatal编程技术网

cURL命令行到PHP

cURL命令行到PHP,php,curl,ssl-certificate,ssl,Php,Curl,Ssl Certificate,Ssl,我必须从PHP向带有自签名证书的安全https服务器发出请求。我在cURL中有一个正常工作的命令行,但是在将其转换为正确且正常工作的PHP选项时遇到了很多问题 工作旋度命令如下所示: curl--cacert cert.pem --密钥证书 --cert.crt --标题“内容类型:文本/xml” -X柱 --data@ftit-request.xmlhttps://serverip/dip/DipWebservice >输出文件 有人能给我一些关于如何在PHP中正确使用这种方法的提示吗?

我必须从PHP向带有自签名证书的安全https服务器发出请求。我在cURL中有一个正常工作的命令行,但是在将其转换为正确且正常工作的PHP选项时遇到了很多问题

工作旋度命令如下所示:

curl--cacert cert.pem
--密钥证书
--cert.crt
--标题“内容类型:文本/xml”
-X柱
--data@ftit-request.xmlhttps://serverip/dip/DipWebservice >输出文件
有人能给我一些关于如何在PHP中正确使用这种方法的提示吗?


这不起作用,我想我缺少了--key cert.key?请阅读php文档中的文章。我显示了创建“.pem”文件所需的代码。我需要将.crt和.key转换/加入到.pem文件中。cat cert.crt cert.key>cert.pem。在那之后,它起作用了。这不起作用,我想我缺少了--key cert.key?阅读php文档中的文章。我显示了创建“.pem”文件所需的代码。我需要将.crt和.key转换/加入到.pem文件中。cat cert.crt cert.key>cert.pem。在那之后,它起了作用。
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');