Okay this is probably gonna be a stupid question, but I haven't worked with HTTP much and can't seem to wrap my head around it. I'm trying to create a basic java application to control an Axis Network camera. Now I've figured out that via HTTP I can move the camera such as this:
Move it left:
http://xxx.xxxx.xxxx.xxxx/axis-cgi/com/ptz.cgi?move=left
Move it right:
http://xxx.xxxx.xxxx.xxxx/axis-cgi/com/ptz.cgi?move=right
Etc.
Now typing these addresses into a web browser of a computer on the network with the camera causes the camera to do the action. I want to be able to make a java app that (Posts?) that website address when the appropriate button is press. (Left, Right, Etc.)
I've trying establishing a connection to the camera at http://xxx.xxx.xxx.xxx/ then getting the output stream and trying to write "http://xxx.xxxx.xxxx.xxxx/axis-cgi/com/ptz.cgi?move=left" to the connection. But nothing happens and I really do think this is doing it edit: wrong* anyways.
My code:
import java.io.DataOutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
public class AxisCameraControlTest {
private static HttpURLConnection connection;
public static void main(String[] args) throws Exception {
connection = (HttpURLConnection)new URL("http://xxx.xxx.xxx.xxx/axis-cgi/com/ptz.cgi?").openConnection();
connection.setDoOutput(true);
DataOutputStream printout = new DataOutputStream (connection.getOutputStream ());
String content = "http://10.0.1.4/axis-cgi/com/ptz.cgi?move=left";
printout.writeBytes (content);
printout.flush ();
printout.close ();
}
}
Any help would be greatly appreciated.
Thanks,
Brayden
Edited by: BraydenJames on May 21, 2010 2:53 PM