-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcamera_control.php
38 lines (34 loc) · 1.08 KB
/
camera_control.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
function cors() {
if (isset($_SERVER['HTTP_ORIGIN'])) {
header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Max-Age: 86400');
}
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']))
header("Access-Control-Allow-Methods: GET, POST, OPTIONS");
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']))
header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}");
exit(0);
}
}
cors();
error_reporting(E_ALL ^ E_NOTICE);
$ip = $_GET["ip"];
$user = $_GET["user"];
$pwd = $_GET["pwd"];
$param = $_GET["param"];
$value = $_GET["value"];
if(!isset($ip)){
echo("ip needs to be set ip=[ipadress]");
}
if(!isset($pwd)){
$pwd = "admin";
}
if(!isset($user)){
$user = "admin";
}
$getdata = file_get_contents('http://'. $ip .'/camera_control.cgi?user=' . $user . '&pwd=' . $pwd . '¶m=' . $param . '&value=' . $value);
echo $getdata;
?>