Php 用卷曲器处理TLSv1.2连接
我正在尝试从其embbedweb服务器(自签名证书)自动配置x-IP摄像机。因此,如果您尝试以正常方式(无脚本)通过浏览器连接到相机,则必须添加一个异常,可以正常工作。 我想实现这一点的自动化,我的所有PHP脚本都在Powershell CLI中运行 我有以下PHP脚本:Php 用卷曲器处理TLSv1.2连接,php,ssl,curl,tls1.2,Php,Ssl,Curl,Tls1.2,我正在尝试从其embbedweb服务器(自签名证书)自动配置x-IP摄像机。因此,如果您尝试以正常方式(无脚本)通过浏览器连接到相机,则必须添加一个异常,可以正常工作。 我想实现这一点的自动化,我的所有PHP脚本都在Powershell CLI中运行 我有以下PHP脚本: <?php include('C:\wamp64\bin\php\php7.0.10\run\Librairie\LIB_parse.php'); include('C:\wamp64\bin\php\php7.0.10
<?php
include('C:\wamp64\bin\php\php7.0.10\run\Librairie\LIB_parse.php');
include('C:\wamp64\bin\php\php7.0.10\run\Librairie\LIB_http.php');
include('C:\wamp64\bin\php\php7.0.10\run\Librairie\LIB_resolve_addresses.php');
$TableauIP = fopen('C:\wamp64\bin\php\php7.0.10\run\x\Ipcamera.txt', 'r');
$count = 0;
while (($URLcamera = fgets($TableauIP, 4096)) !== false){
$IP_unparsed = $URLcamera;
$Ipcamera = return_between($IP_unparsed, "//", "/", EXCL);
echo("Automatic configuration for : ".$Ipcamera."\n");
echo("...............\n\n");
echo("Downloading page : ".$IP_unparsed."\n\n");
$web_page =http_get($IP_unparsed, $ref = "");
echo "ERROR \n";
var_dump($web_page['ERROR']);
$head_section = return_between($string=$web_page['FILE'], $start="<head>", $end="</head>", $type=EXCL);
$meta_tag_array = parse_array($head_section, $beg_tag="<meta", $close_tag=">");
for($xx=0; $xx<count($meta_tag_array); $xx++){
echo $meta_tag_array[$xx]."\n";
}
for($xx=0; $xx<count($meta_tag_array); $xx++){
$meta_attribute = get_attribute($meta_tag_array[$xx], $attribute="http-equiv");
if(strtolower($meta_attribute)=="refresh"){
$new_page = return_between($meta_tag_array[$xx], $start="URL", $end=">", $type=EXCL);
$new_page = trim(str_replace("", "", $new_page));
$new_page = str_replace("=", "", $new_page);
$new_page = str_replace("\"", "", $new_page);
$new_page = resolve_address($new_page, $IP_unparsed);
}
break;
}
echo "HTML Head redirection detected<br>\n\n";
echo "Redirect page = ".$new_page."\n";
$web_page2 = http_get($new_page, $ref = "");
//$web_page = http_get($IP_unparsed.'/login.cs', $ref = "");
echo "FILE CONTENT \n";
var_dump($web_page2['FILE']);
echo "FILE ERROR \n";
var_dump($web_page2['ERROR']);
// for($xx=0; $xx<count($web_page); $xx++){
// echo($web_page[$xx]);
// }
// echo "ERROR \n";
// var_dump($new_page['ERROR']);
//*******************************
// $web_page = file($new_page);
// for($xx = 0; $xx < count($web_page); $xx++)
// echo $web_page[$xx];
//********************************
// $file_handle = fopen($new_page, "r");
// while (!feof($file_handle))
// {
// echo fgets($file_handle, 4096);
// }
// fclose($file_handle);
$count++;
}
?>
我不知道如何使用cURL处理TLS连接。我已经试了好几个小时用不同的东西。。我有以下问题:加密警报:
我已将这一行添加到原始库中:
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
//curl_setopt($ch, CURLOPT_SSLVERSION, 6);
curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
我找不到网页。
显然,SSL版本是1.0.2h。
我试过很多不同的东西。。有许多不同的错误类型,但总是围绕SSL证书之类的东西
我不知道该去哪里找。。
如果你们能给我线索!那太好了Wireshark捕获告诉我们有加密警报(21)。这是因为客户端没有将证书发送回服务器吗?商店在哪里?在公羊里?或者在某个地方的缓存中?我想尝试直接从这个脚本获取证书并将其发送回服务器。是否可以使用PHP/CURL应用程序语言提取此证书?Wireshark捕获告诉我们有一个加密警报(21)。这是因为客户端没有将证书发送回服务器吗?商店在哪里?在公羊里?或者在某个地方的缓存中?我想尝试直接从这个脚本获取证书并将其发送回服务器。是否可以使用PHP/CURL应用程序语言提取此证书?
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
//curl_setopt($ch, CURLOPT_SSLVERSION, 6);
curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);