HTTP PUT command

11 thoughts on “HTTP PUT command

  1. Hi,

     

    I’m looking for help with sending a string of data to a server using PUT.

     

    In Linux, I use the following command and it works straight off:

    curl -X PUT http://localhost/testfolder/putdb2.php -d string=C:21:21:22:23

     

    My GET command works:

    AT##SGACT=1,1

    AT##SD=1,0,80,”SOME IP ADDRESS”,0,0,0

    GET /testfolder/putdb2.php?id=200&instp=201&ptoday=202&ptotal=203 HTTP/1.0$0D$0A

    Host: SOME IP ADDRESS$0D$0A

    Connection: keep-alive$0D$0A$0D$0A

     

    But I want to use thw following

    AT##SGACT=1,1

    AT##SD=1,0,80,”SOME IP ADDRESS”,0,0,0

    Transfer-Encoding: chunked$0D$0A

    PUT /testfolder/putdb2.php -d string=C:21:21:22:23 HTTP/1.1$0D$0A

    Host: SOME IP ADDRESS$0D$0A

    Connection: keep-alive$0D$0A$0D$0A 

     

    but I get  

    HTTP/1.0 400 Bad request

    Connection: close

    Content-Type: text/plain

    Date: Mon May 13 12:05:54 2013

    Server: 

     

    Request could not be understood( Status: 400 )

    NO CARRIER

     

    I believe I may be missing header information or something else. 

     

     

    NB The $0A and $0D are just Carriage Return and Line Feed to ensure they are being sent correctly.

     

    Also I’m using the GC864 in the EVK2 Evaluation Kit and I’m using Terminal by Br@y to communicate over serial. 

      1. Note there is an HTTP POST/PUT facility included in firmware, see AT#HTTPSND command.

      2. Indeed is wrong request forming, see for example here.

        That’s perfect, I’ve searched and found hundreds of pages, but this is the exact format.

         

        I’ll have a look into the AT#HTTPSND command as well.

         

        Thanks again. 

        1. Indeed is wrong request forming, see for example here.

          That’s perfect, I’ve searched and found hundreds of pages, but this is the exact format.

           

          I’ll have a look into the AT#HTTPSND command as well.

           

          Thanks again. 

          Hi again Cosmin,
          I’ve tried using the HTTPSND command and all I get is error, the same goes for HTTPCFG. Do I need to change some setting in order for HTTPCFG to work? 

          AT#HTTPCFG=?
          ERROR
          AT#HTTPCFG?
          ERROR
           
           Also, I’m having no luck at all trying to send PUT request. Based on the link you suggested, the following should work.
           
          AT&K0 
          AT#SGACT=1,1
          AT#SD=1,0,80,"SOME IP ADDRESS",0,0,0
          PUT /testfolder/putdb3.php HTTP/1.1<CR><LF>
          Content-Length: 100<CR><LF>
          Host: SOME IP ADDRESS<CR><LF>
          Connection: close<CR><LF>
          string=C:21:21:22:23<CR><LF><CR><LF>
           
          I’m still getting bad request. 
          1. Regarding #HTTPSND do you have the latest firmware?

             
            I’ve just updated the firmware using the XFP Tool. Downloaded the firmware from RoundSolutions website.
            Here’s the firmware version I have now: 
            AT+CGMR
            10.00.055
            OK
             
            AT+CGMM
            GC864-QUAD-V2
            OK
          2.  

            Got the email, updated from 10.00.055 to 10.00.057  and now HTTPCFG comes back with  

             

            #HTTPCFG: 0,"",80,0,"","******",0,120,1

            #HTTPCFG: 1,"",80,0,"","******",0,120,1

            #HTTPCFG: 2,"m2mlocate.telit.com",9978,0,"","******",0,120,1 

             

             

            Thanks again for your help. 

             

            One last thing, when I’m logged out, I get the basic information in the Download Zone, when I’m logged in, it tells me i need to be an employee to download anything. I’m sure there is something wrong with my account. 

          3. Great, you can use the HTTP client now.

            Regarding the DZ try the "Contact us" link on top of the page or your direct link with your Telit vendor or Representative.