From 05865027edeaf6e3f972a4a0e9382d1283a74777 Mon Sep 17 00:00:00 2001 From: Oliver Hynds Date: Sat, 6 Jan 2018 10:40:17 +0000 Subject: [PATCH 1/7] Create Proxy.php --- Proxy.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Proxy.php diff --git a/Proxy.php b/Proxy.php new file mode 100644 index 0000000..235823b --- /dev/null +++ b/Proxy.php @@ -0,0 +1,17 @@ +\n"; // error handling +} else { + $urlstring = "GET ".$url." HTTP/1.0\r\n\r\n"; + fputs ($fp, $urlstring); + while ($str = trim(fgets($fp, 4096))) + header($str); + fpassthru($fp); + fclose($fp); +} +?> From 25e801e9e854a00feeb7d05abeb9fb6dd4495505 Mon Sep 17 00:00:00 2001 From: Oliver Hynds Date: Sat, 6 Jan 2018 10:41:32 +0000 Subject: [PATCH 2/7] Delete exampleConfig.ini --- exampleConfig.ini | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 exampleConfig.ini diff --git a/exampleConfig.ini b/exampleConfig.ini deleted file mode 100644 index 9b05b32..0000000 --- a/exampleConfig.ini +++ /dev/null @@ -1,35 +0,0 @@ -;tenvis example -[wc1] -logFile="/tmp/tenvis.log" -username=user1 -password=pass1 -url="http://192.168.1.0:7777" -mjpeg="vjpeg.v?user={USER}&pwd={PASS}" -moveLeft="cgi-bin/control.cgi?action=cmd&code=2&value=4" -stopLeft="cgi-bin/control.cgi?action=cmd&code=3&value=4" -moveRight="cgi-bin/control.cgi?action=cmd&code=2&value=3" -stopRight="cgi-bin/control.cgi?action=cmd&code=3&value=3" -moveUp="cgi-bin/control.cgi?action=cmd&code=2&value=1" -stopUp="cgi-bin/control.cgi?action=cmd&code=3&value=1" -moveDown="cgi-bin/control.cgi?action=cmd&code=2&value=2" -stopDown="cgi-bin/control.cgi?action=cmd&code=3&value=2" -boundary=ipcamera - - -;foscam example -[wc2] -logFile = "/tmp/foscam.log" -url="http://192.168.1.0:80" -username = user -password = pass1 -mjpeg="videostream.cgi?user={USER}&pwd={PASS}" -moveLeft="decoder_control.cgi?command=6&user={USER}&pwd={PASS}" -stopLeft="decoder_control.cgi?command=1&user={USER}&pwd={PASS}" -moveRight="decoder_control.cgi?command=4&user={USER}&pwd={PASS}" -stopRight="decoder_control.cgi?command=1&user={USER}&pwd={PASS}" -moveUp="decoder_control.cgi?command=0&user={USER}&pwd={PASS}" -stopUp="decoder_control.cgi?command=1&user={USER}&pwd={PASS}" -moveDown="decoder_control.cgi?command=2&user={USER}&pwd={PASS}" -stopDown="decoder_control.cgi?command=1&user={USER}&pwd={PASS}" -boundary=ipcamera - From 092f875802b3e3937357e0c36f7a614353758183 Mon Sep 17 00:00:00 2001 From: Oliver Hynds Date: Sat, 6 Jan 2018 10:41:45 +0000 Subject: [PATCH 3/7] Delete index.html --- index.html | 54 ------------------------------------------------------ 1 file changed, 54 deletions(-) delete mode 100644 index.html diff --git a/index.html b/index.html deleted file mode 100644 index acbe51f..0000000 --- a/index.html +++ /dev/null @@ -1,54 +0,0 @@ - - - - - From 14cef5743b95c2a6aa83a8e7a6508ec367d3626e Mon Sep 17 00:00:00 2001 From: Oliver Hynds Date: Sat, 6 Jan 2018 10:42:21 +0000 Subject: [PATCH 4/7] Delete webcamProxy.php --- webcamProxy.php | 58 ------------------------------------------------- 1 file changed, 58 deletions(-) delete mode 100644 webcamProxy.php diff --git a/webcamProxy.php b/webcamProxy.php deleted file mode 100644 index 00c013e..0000000 --- a/webcamProxy.php +++ /dev/null @@ -1,58 +0,0 @@ -$value) { - $value = str_replace("{USER}", $currentConfig['username'], $value); - $value = str_replace("{PASS}", $currentConfig['password'], $value); - $newConfig[$key] = $value; - } - return $newConfig; -} - - -##MAIN: -if (!function_exists('curl_init')) { - echo "php curl support must be installed!!!"; - exit(1); -} -if(!isset($_GET['webcam']) || !isset($_GET["cmd"])) { - echo "require a webcam and a cmd param!"; - exit(1); -} -$tmp = file_get_contents("webcamConfig.ini"); -$configFile = parse_ini_string($tmp, true); -$currentConfig = $configFile[$_GET['webcam']]; - -header("Connection: close"); -header("Content-Type: multipart/x-mixed-replace;boundary=".$currentConfig['boundary']); - - -$currentConfig = UpdateConfigStrings($currentConfig); - -if($currentConfig['logFile'] !== false) { - $fp = fopen($currentConfig['logFile'], 'a'); - fwrite($fp, "IN FROM CLIENT:\n".print_r($_GET, true)."\n----------\n"); - fwrite($fp, print_r($currentConfig, true)."\n----------\n"); - fwrite($fp, $currentConfig['url']."/".$currentConfig[$_GET['cmd']]."\n----------\n"); - fclose($fp); -} - -$out = Fetch($currentConfig['url']."/".$currentConfig[$_GET['cmd']], $currentConfig); From ff2da396489bcb9da34c08b7e6f99e74f28defad Mon Sep 17 00:00:00 2001 From: Oliver Hynds Date: Sat, 6 Jan 2018 10:42:32 +0000 Subject: [PATCH 5/7] Delete index.html --- index.html | 54 ------------------------------------------------------ 1 file changed, 54 deletions(-) delete mode 100644 index.html diff --git a/index.html b/index.html deleted file mode 100644 index acbe51f..0000000 --- a/index.html +++ /dev/null @@ -1,54 +0,0 @@ - - - - - From f880e4d8c47f42111e2cbff864595f577556d094 Mon Sep 17 00:00:00 2001 From: Oliver Hynds Date: Sat, 6 Jan 2018 10:43:49 +0000 Subject: [PATCH 6/7] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 2c2c449..5206989 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,5 @@ # php-webcam-proxy Simple php proxy for mjpeg webcam endpoints + ## how to use + > Change the veriables in the top of `proxy.php`. + > done! From 44a9144e7c2ce5d510db73e8035895af78ce8241 Mon Sep 17 00:00:00 2001 From: Oliver Hynds Date: Sat, 6 Jan 2018 10:44:00 +0000 Subject: [PATCH 7/7] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5206989..b57fe5e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # php-webcam-proxy Simple php proxy for mjpeg webcam endpoints ## how to use - > Change the veriables in the top of `proxy.php`. - > done! + - Change the veriables in the top of `proxy.php`. + - done!