Jump to content

Pshhh

Members
  • Content Count

    1
  • Joined

  • Last visited

Community Reputation

0 Neutral
  1. сорри за некропост ) USE IT <?php $xml_data = '<?xml version="1.0" encoding="UTF-8"?> <TextOverlay version="1.0" xmlns="http://www.hikvision.com/ver10/XMLSchema"> <id>1</id> <enabled>true</enabled> <posX>16</posX> <posY>0</posY> <message>Temp: -0.5C</message> </TextOverlay>'."\r\n"; $user = "admin"; $pass = "12345"; $host = '192.168.1.218'; $path = '/Video/inputs/channels/1/overlays/text/1'; //открываем сокет $fp = @fsockopen("tcp://".$host, 80, $errno, $errstr, 10); if (!$fp) { die($errstr.':'.$errno); } else { $header = "PUT $path HTTP/1.1\r\n"; $header .= "Authorization: Basic ".base64_encode("$user:$pass")."\r\n"; $header .= "User-Agent: php-script\r\n"; $header .= "Host: $host\r\n"; $header .= "Accept: */*\r\n"; $header .= "Content-Length: ".strlen($xml_data)."\r\n\r\n"; //посылаем данные fwrite($fp, $header.$xml_data); $headers=''; //читаем заголовки while ($str = trim(fgets($fp, 4096))) $headers .= "$str\n"; $body=''; //читаем ответ while (!feof($fp)) $body.= fgets($fp, 4096); //закрываем сокет fclose($fp); } //выводим данные echo $headers.'<hr/>'.$body; ?>
×