I just made this php script to move a webcam using it's built in features to exactly where I want it, but I kinda want it in C (which I'm not experienced in) and not PHP. Can somebody please help me or lead me in the right direction to start converting it?
<?php
$options = array(
"home" => "http://example.com/webcam/ptz.cgi?camera=1&move=home",
"up" => "http://example.com/webcam/ptz.cgi?camera=1&move=up",
"down" => "http://example.com/webcam/ptz.cgi?camera=1&move=down",
"left" => "http://example.com/webcam/ptz.cgi?camera=1&move=left",
"right" => "http://example.com/webcam/ptz.cgi?camera=1&move=right",
"in" => "http://example.com/webcam/ptz.cgi?camera=1&rzoom=500",
"out" => "http://example.com/webcam/ptz.cgi?camera=1&rzoom=500",
"near" => "http://example.com/webcam/ptz.cgi?camera=1&rfocus=500",
"far" => "http://example.com/webcam/ptz.cgi?camera=1&rfocus=500"
);
$directions = array("home", "left", "left", "in", "in", "in", "left", "left");
$curl = curl_init();
foreach($directions as $direction){
curl_setopt($curl, CURLOPT_URL, $options[$direction]);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_exec($curl);
sleep(1);
}
curl_close($curl);
sleep(5);
$new = fopen("snaps/".time().".jpg", 'w');
fwrite($new, file_get_contents("http://example.com/webcam/jpg//image.jpg?timestamp=".time()));
fclose($new);
I'd really appreciate it.


Sign In
Create Account

Back to top









