Search code examples
httpgsmsim900

Getting bad request response When sending data to server using SIM900


AT+CSTT="live.vodafone.com"$0D$0A                       OK

AT+CIPSHUT$0D$0A                                        SHUT OK

AT+CIPMUX=0$0D$0A                                       OK

AT+CLPORT="TCP",80$0D$0A                                OK

AT+CIICR$0D$0A                                          OK

AT+CIPSTART="TCP","http://ph.mydomain.in",80$0D$0A      OK   CONNECT OK

AT+CIPSEND$0D$0A                                        

GET /phreading.aspx?value=092016040804550815 HTTP/1.1$0D$0A
Host: http://www.ph.mydomain.in$0D$0A$0D$0A
$1A

than i get following error.

enter image description here Please help me to solve this problem. and tell me the right sequence to send data on server correctly.


Solution

  • Try to use AT+HTTPPARA command to send your get request. Its much easier than using the CIPSEND method.

    Connect to GPRS

    AT+CGATT?
    AT+SAPBR=3,1,"CONTYPE","GPRS"
    AT+SAPBR=3,1,"APN","live.vodafone.com"
    AT+SAPBR=3,1,"USER","APN_USERNAME"  // adapt it to yours
    AT+SAPBR=3,1,"PWD","APN_PASSWORD" // adapt it to yours
    AT+SAPBR=1,1
    

    SEND DATA USING HTTP GET

    AT+HTTPINIT
    AT+HTTPPARA="CID",1
    AT+HTTPPARA="URL","www.ph.mydomain.in//phreading.aspx?value=092016040804550815"
    AT+HTTPACTION=0 // sends HTTP GET  
    AT+HTTPTERM  // terminate HTTP request
    AT+SAPBR=0,1 // disconnect gprs if required
    

    Hope this helps..