Find the answer to your Linux question:
Results 1 to 5 of 5
Hi guys, im new to linux and i want to be able hit a URL in a browser from my linux box. The purpose of hiting the url is to ...
  1. #1
    Just Joined!
    Join Date
    Aug 2008
    Posts
    6

    hiting url from linux machine

    Hi guys,

    im new to linux and i want to be able hit a URL in a browser from my linux box. The purpose of hiting the url is to synchronize some data i have between databases.

    I have looked at a couple of options like wget and CURL but when i try these out with some random URL i just get a message -- connecting.. and i dont know id my linux box has hit the url or not.

    I dont need to display the page i just want to be sure that the request makes it to the browser so my synch method is kicked off.

    Any suggestions? Maybe i need to do something more intensive like creating a perl script or something to do this? cheers!

  2. #2
    Linux Engineer GNU-Fan's Avatar
    Join Date
    Mar 2008
    Posts
    935
    What is a "hit"? A HTTP GET request?

    If so, create a file

    Code:
    GET / HTTP1.1
    Host: dontmind
    Pipe that file to netcat:
    cat requestfile | nc thehost 80

    This should "hit" this host.

  3. #3
    Just Joined!
    Join Date
    Aug 2008
    Posts
    6
    cool thanks, ya its a Get request i want to send, sorry for not being abit more specific.

  4. #4
    Just Joined!
    Join Date
    Aug 2008
    Posts
    6
    ok so just to be 100% sure , what should i be using after the nc command for the "thehost" string?

  5. #5
    Linux Engineer GNU-Fan's Avatar
    Join Date
    Mar 2008
    Posts
    935
    The host's IP address of course, or a hostname that can be resolved to such an IP.

    Say you wanted to obtain the page
    Code:
    http://www.gnu.org/philosophy/free-sw.html
    Then you would put

    Code:
    GET philosophy/free-sw.html HTTP1.1
    Host: www.gnu.org
    cat requestfile | nc gnu.org 80

    This is essentially the same your browser sends to the side if you visit it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...