Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: [solved] HTTP request from DOS batch, is this possible ?  (Read 67485 times)

0 Members and 1 Guest are viewing this topic.

Narsil

  • Guest
[solved] HTTP request from DOS batch, is this possible ?
« 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
« Last Edit: September 07, 2007, 06:58:14 AM by Narsil »

Narsil

  • Guest
Re: HTTP request from DOS batch, is this possible ?
« Reply #1 on: September 04, 2007, 09:51:42 AM »
PS: Even better if a POST data could be added to the request ...

Amrykid



    Beginner

  • Piplup rules!!!!!!!!
    Re: HTTP request from DOS batch, is this possible ?
    « Reply #2 on: September 04, 2007, 04:55:13 PM »
    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.
    Laptop Specs:
    Manufacturer:Gateway
    Model:MT3705
    OS:Windows Vista Home Premium
    Processor:Intel Pentium Dual-Core Mobile Processor 1.60 GHz, 533 MHz FSB
    Graphics:ATI Readeon Xpress 200M Graphics with 256 HyperMemory
    Memory:1024 MB DDR2
    Network: B/G WLAN Card, 10/100 mbps Ethernet LAN, 56k Fax/Modem

    Narsil

    • Guest
    Re: HTTP request from DOS batch, is this possible ?
    « Reply #3 on: September 04, 2007, 11:56:24 PM »
    Thanks Amrykid,

    Stupid question : what do i need to install run a vb script ?

    ghostdog74



      Specialist

      Thanked: 27
      Re: HTTP request from DOS batch, is this possible ?
      « Reply #4 on: September 05, 2007, 01:51:51 AM »
      see here.

      Amrykid



        Beginner

      • Piplup rules!!!!!!!!
        Re: HTTP request from DOS batch, is this possible ?
        « Reply #5 on: September 05, 2007, 05:11:53 PM »
        you dont need to install anything to run a VB script ;D. just save that code to http.vbs through notepad ;D
        Laptop Specs:
        Manufacturer:Gateway
        Model:MT3705
        OS:Windows Vista Home Premium
        Processor:Intel Pentium Dual-Core Mobile Processor 1.60 GHz, 533 MHz FSB
        Graphics:ATI Readeon Xpress 200M Graphics with 256 HyperMemory
        Memory:1024 MB DDR2
        Network: B/G WLAN Card, 10/100 mbps Ethernet LAN, 56k Fax/Modem

        gamerx365



          Adviser
        • Radda Radda!
        • Thanked: 1
          • Yes
          • Yes
        • Experience: Experienced
        • OS: Windows 10
        Re: HTTP request from DOS batch, is this possible ?
        « Reply #6 on: September 05, 2007, 05:20:48 PM »
        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?

        Narsil

        • Guest
        Re: HTTP request from DOS batch, is this possible ?
        « Reply #7 on: September 06, 2007, 12:37:57 AM »
        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

        ghostdog74



          Specialist

          Thanked: 27
          Re: HTTP request from DOS batch, is this possible ?
          « Reply #8 on: September 06, 2007, 01:55:08 AM »
          one 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"

          Narsil

          • Guest
          Re: HTTP request from DOS batch, is this possible ?
          « Reply #9 on: September 06, 2007, 02:27:20 AM »
          OR, you can use Windows Curl...search the web for "Curl for windows"

          Oh oh ! This one's good !

          Keep It Simple  8)

          mariah

          • Guest
          Re: HTTP request from DOS batch, is this possible ?
          « Reply #10 on: September 07, 2007, 06:53:28 AM »
          example:

          @echo off
          "C:\Program Files\Internet Explorer\IEXPLORE.EXE" "http://hotmail.com"
          cls
          exit

          is this what you needed?

          Narsil

          • Guest
          Re: [solved] HTTP request from DOS batch, is this possible ?
          « Reply #11 on: September 07, 2007, 07:01:05 AM »
          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