Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

SIM900A Post HTTP headers

Status
Not open for further replies.

alexor2k

Newbie level 1
Newbie level 1
Joined
May 18, 2018
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
11
Hello,

I am using Arduino Uno board with SIM900A GSM Module.
I am trying to send HTTP Post request to a secure server.
All is being received in the server, besides the header, its a secure server, it requires an authorization header.
Below is my code, content header is being received, body data is also being received by the server.
Only authorization header is not getting to the server , please help.

Code:
Serial.println("HTTP get method :");

Serial.print("AT\\r\\n");
GSMModule.println("AT");  /* Check Communication */

Serial.print("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"\\r\\n");
GSMModule.println("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"");  /* Connection type GPRS */


Serial.print("AT+SAPBR=3,1,\"APN\",\"uinternet\"\\r\\n");
GSMModule.println("AT+SAPBR=3,1,\"APN\",\"uinternet\"");  /* APN of the provider */


Serial.print("AT+SAPBR=1,1\\r\\n");
GSMModule.println("AT+SAPBR=1,1"); /* Open GPRS context */


Serial.print("AT+SAPBR=2,1\\r\\n");
GSMModule.println("AT+SAPBR=2,1"); /* Query the GPRS context */


Serial.print("AT+HTTPINIT\\r\\n");
GSMModule.println("AT+HTTPINIT"); /* Initialize HTTP service */


Serial.print("AT+HTTPSSL=1\\r\\n");
GSMModule.println("AT+HTTPSSL=1"); /* Initialize SSL service */

Serial.print("AT+CMEE=1\\r\\n");
GSMModule.println("AT+CMEE=1"); /* Initialize Errors service */


Serial.print("AT+HTTPPARA=\"CID\",1\\r\\n");
GSMModule.println("AT+HTTPPARA=\"CID\",1");  /* Set parameters for HTTP session */


Serial.print("AT+HTTPPARA=\"URL\",\"42a149e7.ngrok.io/api\"\\r\\n");
GSMModule.println("AT+HTTPPARA=\"URL\",\"42a149e7.ngrok.io/api\"");  /* Set parameters for HTTP session */

Serial.print("AT+HTTPPARA=\"USERDATA\",\"Authorization sr=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\"");
GSMModule.println("AT+HTTPPARA=\"USERDATA\",\"Authorization sr=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\"");  /* Set Content parameters for HTTP session */


Serial.print("AT+HTTPPARA=\"CONTENT\",\"application/json\"");
GSMModule.println("AT+HTTPPARA=\"CONTENT\",\"application/json\"");  /* Set Content parameters for HTTP session */



Serial.print("AT+HTTPDATA=" + String(reading.length()) + ",100000");
GSMModule.println("AT+HTTPDATA=" + String(reading.length()) + ",100000");  /* Set parameters for HTTP session */

Serial.print(reading);
GSMModule.println(reading);  /* Set parameters for HTTP session */


Serial.print("AT+HTTPACTION=1\\r\\n");
GSMModule.println("AT+HTTPACTION=1");  /* Start POST session */


Serial.print("AT+HTTPREAD\\r\\n");
GSMModule.println("AT+HTTPREAD");  /* Read data from HTTP server */


Serial.print("AT+HTTPTERM\\r\\n");
GSMModule.println("AT+HTTPTERM");  /* Terminate HTTP service */


Serial.print("AT+SAPBR=0,1\\r\\n");
GSMModule.println("AT+SAPBR=0,1"); /* Close GPRS context */
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top