Permalink
Browse files

Merge pull request #277 from tarasfrompir/master

исправлена функция получения лого
  • Loading branch information...
T-REX-XP committed Sep 13, 2018
2 parents 4ec77a0 + 84a75e8 commit a0a2e4d15588bac84e52b2af30c5035d2299c049
@@ -186,13 +186,13 @@ function startsWith($haystack, $needle){
function getServices($device){
$result = array();
if(isset($device["serviceList"]["service"]["serviceType"])){
$name = explode(":", $device["serviceList"]["service"]["serviceType"])[3];
$name = explode(":", $device["serviceList"]["service"]["serviceType"])[3].':'.explode(":", $device["serviceList"]["service"]["serviceType"])[4];
array_push($result,$name);
}
else{
foreach($device["serviceList"]["service"] as $type)
{
$name = explode(":", $type["serviceType"])[3];
$name = explode(":", $type["serviceType"])[3].':'.explode(":", $type["serviceType"])[4];
array_push($result,$name);
}
}
@@ -270,7 +270,12 @@ function getDefImg($control_url,$device) {
$mimetype = isset($arrImg[0]["mimetype"]) ? $arrImg[0]["mimetype"]: $icons[0]["mimetype"];
}
}
$path = $baseUrl . $url;
//иногда ссылка дается полностью с всем адресом
if (substr($url, 0, 4) == "http") {
$path = $url;
} else {
$path = $baseUrl . $url;
};
$current =get_web_page($path);
$type = pathinfo($path, PATHINFO_EXTENSION);
// иногда в ссылке на лого отсутствует расширение файла поэтому пробуем взять его из типа в XML файле
@@ -148,7 +148,7 @@ public function sendRequestToDevice($method, $arguments, $url, $type, $hostIp =
$body ='<?xml version="1.0" encoding="utf-8"?>' . "\r\n";
$body .='<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">';
$body .='<s:Body>';
$body .='<u:'.$method.' xmlns:u="urn:schemas-upnp-org:service:'.$type.':1">';
$body .='<u:'.$method.' xmlns:u="urn:schemas-upnp-org:service:'.$type.'">';
foreach( $arguments as $arg=>$value ) {
$body .='<'.$arg.'>'.$value.'</'.$arg.'>';
}
@@ -162,7 +162,7 @@ public function sendRequestToDevice($method, $arguments, $url, $type, $hostIp =
'Content-Length: ' . strlen($body),
'Connection: close',
'Content-Type: text/xml; charset="utf-8"',
'SOAPAction: "urn:schemas-upnp-org:service:'.$type.':1#'.$method.'"',
'SOAPAction: "urn:schemas-upnp-org:service:'.$type.'#'.$method.'"',
);
$ch = curl_init();

0 comments on commit a0a2e4d

Please sign in to comment.