Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/235.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
php 5.3 cUrl/linux cmd cUrl https_Php_Linux_Ssl_Curl_Https - Fatal编程技术网

php 5.3 cUrl/linux cmd cUrl https

php 5.3 cUrl/linux cmd cUrl https,php,linux,ssl,curl,https,Php,Linux,Ssl,Curl,Https,我在php中使用cURL设置https连接时遇到问题。 下面是我的php代码,用于设置连接 $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $endlocation); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETUR

我在php中使用cURL设置https连接时遇到问题。 下面是我的php代码,用于设置连接

$ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $endlocation);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_CAINFO, $certificate);
    curl_setopt($ch, CURLOPT_PORT, $portNumber);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        'Content-Type: application/json',
        'Content-Length: ' . strlen($data))
    );
    $result = curl_exec($ch);
以下变量为:

$endlocation = "https://lms.lifeline.nl/mailwebservice/inline/"
$data = json encoded data
$certificate = true path to .crt file
$portNumber = 443
当我执行cURL时,我的页面被打断,并且我得到了一个页面错误,该化合物被重新初始化。碰巧我从curl_exec那里得到了一个false

如果我使用此文件不是直接设置连接,而是在同一台服务器上使用linux命令行:

$url = "https://lms.lifeline.nl/mailwebservice/inline";
exec("curl $url", $output, $status);
print_r($output); die;

然后我得到了回复。php格式的cURL exec有什么问题吗?。或者还有什么我需要关注的吗?

CURLOPT_CAINFO:手册上说:只有与CURLOPT_SSL_VERIFYPEER结合使用才有意义。(自PHP7.1以来,该选项可用/已更改)删除CURLOPT_CAINFO并添加CURLOPT_SSL_VERIFYPEER,false/true得到相同的结果,并称为
echo curl_error($ch)这是问题的一部分,curl\u错误只在curl\u exec之后才起作用。如果(!$result=curl\u exec($ch)){echo curl\u error($ch);}
对您不起作用,我的php代码怎么会没有通过这一部分呢?