22-03-2019, 23:49
Trochę poprawiłem mój kod i teraz mam z HTTP 400 Bad Request.
Kod:
#include <SoftwareSerial.h>
SoftwareSerial GSM(3,2);
void setup() {
GSM.begin(9600);
Serial.begin(9600);
Serial.println("Start...");
GSM.println("AT+CSQ");
updateSerial();
GSM.println("AT+CGATT=1");
updateSerial();
GSM.println("AT+CIPSTART=\"TCP\",\"testgolang.cba.pl\",80");
updateSerial();
delay(2000);
GSM.println("at+cipsend=100, /index.php?a=ok HTTP/1.1");
updateSerial();
}
void loop() {
updateSerial();
}
void updateSerial(){
delay(2000);
while(Serial.available())
GSM.write(Serial.read());
while(GSM.available())
Serial.write(GSM.read());
}
Kod:
22:42:02.749 -> Start...
22:42:04.759 -> AT+CSQ
22:42:04.759 ->
22:42:04.759 -> +CSQ: 27,99
22:42:04.759 ->
22:42:04.759 -> OK
22:42:06.781 -> AT+CGATT=1
22:42:06.781 ->
22:42:06.781 -> OK
22:42:08.823 -> AT+CIPSTART="TCP","testgolang.cba.pl",80
22:42:08.859 ->
22:42:08.859 -> CONNECT OK
22:42:08.859 ->
22:42:08.859 -> OK
22:42:12.879 -> at+cipsend=100, /index.php?a=ok HTTP/1.1
22:42:12.917 ->
22:42:12.917 -> OK
22:42:12.917 ->
22:42:12.917 -> +CIPRCV:1344,HTTP/1.1 400 Bad Request
22:42:12.917 -> Server: nginx
22:42:12.955 -> Date: Fri, 22 Mar 2019 21:41:59 GMT
22:42:12.993 -> Content-Type: text/html
22:42:13.026 -> Connection: close
22:42:13.026 -> X-Host-Ip: 80
22:42:13.064 ->
22:42:13.064 -> <html>
22:42:13.064 -> <head><title>400 Bad Request</title></head>
22:42:13.098 -> me">name</label>
22:42:13.136 -> <div class="col-md-4">
22:42:13.172 -> <input id="cumf_bt_name" name="cumf_bt_name" type="text" placeholder="your name" class="cumf_bt_form-control cumf_bt_input-md" />
22:42:13.352 -> <span class="cumf_bt_help-block">Please enter your name</span>
22:42:13.387 -> </div>
22:42:13.425 -> </div>
22:42:13.425 -> <!-- Text input-->
22:42:13.458 -> <div class="cumf_bt_form-group">
22:42:13.492 -> <label class="col-md-4 cumf_bt_control-label" for="cumf_bt_email">your email</label>
22:42:13.598 ->
22:42:13.633 ->
22:42:13.633 -> +CIPRCV:776, <div class="col-md-4">
22:42:13.666 -> <input id="cumf_bt_email" name="cumf_bt_email" type="text" placeholder="enter your email" class="cumf_bt_form-control cumf_bt_input-md" />
22:42:13.845 -> <span class="cumf_bt_help-block">please enter your email</span>
22:42:13.918 -> </div>
22:42:13.918 -> </div>
22:42:13.918 -> <!-- Textarea -->
22:42:13.953 -> <div class="cumf_bt_form-group">
22:42:13.988 -> <label class="col-md-4 cumf_bt_control-label" for="cumf_bt_message">your message</label>
22:42:14.130 -> <div class="col-md-4">
22:42:14.166 -> <textarea class="cumf_bt_form-control" id="cumf_bt_message" name="cumf_bt_message">Message goes here</textarea>
22:42:14.316 -> </div>
22:42:14.316 -> </div>
22:42:14.316 -> <input type="submit" id="cumf_bt_submit" value="Send"/>
22:42:14.390 -> </fieldset>
22:42:14.390 -> </form>
22:42:14.423 -> </div></body>
22:42:14.423 -> </html>
22:42:14.423 ->
22:42:14.423 ->
22:42:14.423 ->
22:42:14.459 -> +TCPCLOSED:0
22:42:16.392 ->
22:42:16.392 -> OK
22:44:15.352 ->
22:44:15.352 -> OK