Computer Hope
Microsoft => Microsoft DOS => Topic started by: Narsil on September 04, 2007, 09:47:56 AM
-
Hi,
I need some help with a very simple batch file that needs to be launched automatically at each start of a Win XP machine.
I need to send an http request to a .php URL to initiate a connection at each boot from a PC. I was wondering if a DOS batch could do that.
Any suggestion ?
Thanks,
Diego
-
PS: Even better if a POST data could be added to the request ...
-
this is a tough one.
requires to things, batch and vbscipt
Batch:start http.vbs
Vbscipt:httprequest("urlhere")
any body else help me if im wrong.
-
Thanks Amrykid,
Stupid question : what do i need to install run a vb script ?
-
see here (http://www.computerhope.com/forum/index.php/topic,40496.0.html).
-
you dont need to install anything to run a VB script ;D. just save that code to http.vbs through notepad ;D
-
im just curious why you would need to do this. Not suspicious of anything, i just am always trying to see what kind of new things I can do with this kind of stuff. so what exactly would this do and why would you need it?
-
No prob'
To remote access my clients machines, who are mostly cable/adsl connected, thus have dynamic IP, i need to know their IP. To do this, I have on my web site a small php script that logs the incoming request's IP in a table this way :
http://mysite.com/iplog/iplog.php/?ident=client1 -> [20070906 08:17] client1 xxx.xxx.xxx.xxx
When needed, I used to ask to my clients to call this URL (saved as bookmark) and picked the IP from the table.
I though I could give better service and do some night maintenance if I could know the IP without their help ...
You can complete by yourself ;)
For my "other world"'s client (linux and Mac), i have the very convenient "curl" command witch can be shell scripted and croned easily, but as my Win world's knowledge are ... lacked, I needed help !
Thanks a lot !
Diego
-
one way in vbscript
set http = CreateObject("microsoft.xmlhttp")
http.open "GET","http://127.0.0.1",false
http.send
htmlpage = http.responsetext
WScript.Echo htmlpage
i leave it to you to get the client IP address...ie..you have to learn some vbscript.
another way is to use netcat...search for netcat (http://www.vulnwatch.org/netcat/) for windows...
eg
echo "GET / HTTP/1.0
" | nc yoururl 80
OR, you can use Windows Curl...search the web for "Curl for windows"
-
OR, you can use Windows Curl...search the web for "Curl for windows"
Oh oh ! This one's good !
Keep It Simple 8)
-
example:
@echo off
"C:\Program Files\Internet Explorer\IEXPLORE.EXE" "http://hotmail.com"
cls
exit
is this what you needed?
-
Thanks mariah.
Your solution's good too
I've choose to install curl for windows. it's light, easy, and i know it !
Thanks to all of you for your suggestions.
Diego