...

View Full Version : Send http command via java or vb



SemiShady
09-07-2007, 12:09 AM
Hello every1. I am using a bluetooth remote control program on my phone. it connects to my computer and allows me to do things. i can add new features either via a .bat file or javascript or vb script.

I already can control my xbox from my computer via its http server. So say i want to restart it i click on this link

http://MYXBOXIPADRESS/xbmcCmds/xbmcForm?command=restart
(which is a blank page)

is there an easy way either via a short .bat , javascript , or vb code i can use to hit that address without ie opening or anything continuing to run. thank for you help

\SemiShady

rnd me
09-09-2007, 07:45 PM
Hello every1. I am using a bluetooth remote


is there an easy way either via a short .bat , javascript , or vb code i can use to hit that address without ie opening or anything continuing to run. thank for you help

\SemiShady

a simple html application should do you nice.

http://msdn2.microsoft.com/en-us/library/ms536496.aspx





<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html><head> <HTA:APPLICATION
ID="IEServer"
APPLICATIONNAME="IEServer2"
BORDER="thick"
BORDERSTYLE="sunken"
CAPTION="no"

MAXIMIZEBUTTON="no"
MINIMIZEBUTTON="no"
SHOWINTASKBAR="no"
SINGLEINSTANCE="no"
SYSMENU="no"
VERSION="1.0"
WINDOWSTATE="minimize" />

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<script>


i= new Image();
i.src="http://myxboxipadress/xbmcCmds/xbmcForm?command=restart";
setTimeout("window.close()", 5000)



</script>

</body>
</html>

paste the text into a blank file, save as ex server.hta
when you double-click it, it should run in th background, ping the url, and close 5 seconds later.

the opening and closing part i know works, let me know if you need more advanced http requests to trigger your server.

ghell
09-09-2007, 08:52 PM
you could get wget for windows and run it from a batch file or use Msxml2.XMLHTTP to do it from vbscript or javascript. (note that javascript is different from Java and VBScript is different to VB)

Here's some example VBScript (untested as I am not on windows right now, I'm going on memory.)
Just put it in a file called something like "restart xbox.vbs" and double click on it.
Set xmlhttp = CreateObject("msxml2.xmlhttp")

xmlhttp.Open "GET", "http://myxboxipadress/xbmcCmds/xbmcForm?command=restart", False
xmlhttp.Send

' Uncomment this to display what the page returned (there is also ResponseXML if you
' need XML instead). You could check that the status is 200 (OK) etc too or just leave
' this commented so that nothing appears on the computer even if it fails

'MsgBox(xmlhttp.ResponseText)

Set xmlhttp = NothingAs you can see it is only 4 lines long and pretty simple but does the job and is flexible to whatever you may need it to do in the future.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum