Home AMX User Forum NetLinx Studio

http GET

Could someone please give me the correct syntax for a string to send to a device that responds to URLs from withing a browser? Thanks.

Comments

  • DHawthorneDHawthorne Posts: 4,584
    It depends on the HTTP server you are connecting to. For, just a simple SEND_STRING dvIP_Connection, "'GET', 13,10,13,10" will work (dvIP_Connection being the device you opened the IP client on). The terminator is the 13,10,13,10 ... two CRLFs in sequences tells the command you are done. Having said that, though, some servers require authentication or other header information before that terminus or they won't give you anything back. If it's a script on the server index page, you need to include the parameters.
  • TurnipTruckTurnipTruck Posts: 1,485
    Entered into a browser http://192.168.1.3/lots_of_modifier_stuff
    Yields the expected results

    Send_String Devive,"'GET http://192.168.1.3/lots_of_modifier_stuff',$0D,$0A,$0D,$0A"
    Returns a 400 bad request.

    ???

    Thanks.
  • the8thstthe8thst Posts: 470
    Entered into a browser http://192.168.1.3/lots_of_modifier_stuff
    Yields the expected results

    Send_String Devive,"'GET http://192.168.1.3/lots_of_modifier_stuff',$0D,$0A,$0D,$0A"
    Returns a 400 bad request.

    ???

    Thanks.

    The IP address goes into your ip_client_open statement. The correct send string would then be:
    send_string dvDevice,"'GET /lost_of_modifier_stuff HTTP/1.0',$0D,$0A,$0D,$0A"
    

    Keep in mind that the server may require more of a complete header. You can use ethereal, url sniffer, or plugins like firebug (firefox) to view the exact headers that you are sending an receiving with your browser if you need more clarification.

    Here are all of the available fields in the header: http://en.wikipedia.org/wiki/List_of_HTTP_headers

    Most devices we talk to really on the GET or POST, Host, Authorization (if password protected), or Content-Length.
  • jjamesjjames Posts: 2,908
    LiveHeaders

    If you use Firefox, check out the LiveHeaders add-in - it shows headers and all the commands (GET, POST, etc) on a connection.
  • Joe HebertJoe Hebert Posts: 2,159
    jjames wrote: »
    If you use Firefox, check out the LiveHeaders add-in - it shows headers and all the commands (GET, POST, etc) on a connection.
    Cool. Thanks for the tip.
  • Have a play around with something along the lines of:
    SEND_STRING dvWeb, "'GET /', path, ' HTTP/1.1', 13,10, 'Host: ', host, 13, 10, 'Connection: Close', 13, 10, 13, 10"
    

    Where host is the site, eg. 'www.amx.com'
    and path is everything after e.g 'products'
  • jjamesjjames Posts: 2,908
    One more add-on

    Forgot to mention this one: Modify Headers

    It allows you to change the headers that are sent whenever you browse a page. So, with the two (LiveHeaders and Modify Headers) you can act as though you're an AMX master, sending only a few specified headers along with your commands, and then you can see what you get back. Sort of a pain to get it all set up the way you want, but can save some time if you're debugging skills / tools aren't the best.
Sign In or Register to comment.