1.

Solve : [solved] HTTP request from DOS batch, is this possible ??

Answer»

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,
DiegoPS: Even better if a POST data could be added to the request ...this is a tough one.
requires to things, batch and vbscipt
Batch:Code: [Select]start http.vbsVbscipt:Code: [Select]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.
you dont need to install anything to run a VB script . just save that code to http.vbs through notepad 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 !

Diegoone way in vbscript
Code: [Select]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 for windows...
eg
Code: [Select]echo "GET / HTTP/1.0

" | nc yoururl 80
OR, you can use Windows Curl...search the web for "Curl for windows"Quote from: ghostdog74 on September 06, 2007, 01:55:08 AM

OR, you can use Windows Curl...search the web for "Curl for windows"

Oh oh ! This one's good !

Keep It Simple 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


Discussion

No Comment Found