• Witaj na Forum Arduino Polska! Zapraszamy do rejestracji!
  • Znajdziesz tutaj wiele informacji na temat hardware / software.
Witaj! Logowanie Rejestracja


Ocena wątku:
  • 0 głosów - średnia: 0
  • 1
  • 2
  • 3
  • 4
  • 5
GPRS Request HTTP - moduł A6 GSM/GPRS - ERROR z GET
#6
(23-03-2019, 00:19)kaczakat napisał(a): Przetestuj skrypt czy działa prawidłowo bez modemu. A linijkę do PHP wysyłałem tak:
client.print(String("GET ") + url + " HTTP/1.1\r\n" + "Host: " + host + "\r\n" + "Connection: close\r\n\r\n");
Oczywiście ty  masz tam użyć na początku "at+cipsend".
No i jak poszukasz na tym forum PHP i MYSQL to ktoś już z tym walczył i rozwiązał problem, może akurat nie przez GSM, ale już wysyłasz i odbierasz, pozostało jeszcze co jest wysłane i jak obsłużone przez PHP.

Kod:
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=80, GET /index.php?a=okok HTTP/1.1 \r\n Host: http://www.testgolang.cba.pl");
  delay(2000);
  GSM.println();
  updateSerial();

}


Zrobiłem jak mówiłeś, ale nadal ten sam problem, może trzeba dodać jakieś jeszcze nagłówki, żeby server wiedział, że to do niego. 

Kod:
Start...
10:44:35.350 -> AT+CSQ
10:44:35.350 -> 
10:44:35.350 -> +CSQ: 24,99
10:44:35.350 -> 
10:44:35.350 -> OK
10:44:37.358 -> AT+CGATT=1
10:44:37.358 -> 
10:44:37.358 -> OK
10:44:39.408 -> AT+CIPSTART="TCP","testgolang.cba.pl",80
10:44:39.442 -> ⸮
10:44:39.442 -> CONNECT OK
10:44:39.442 -> 
10:44:39.442 -> OK
10:44:45.500 -> at+cipsend=80, GET /index.php?a=okok HTTP/1.1 
10:44:45.537 ->  Host: http://www.testgolang.cba.pl
10:44:45.575 -> ⸮
10:44:45.575 -> 
10:44:45.575 -> OK
10:44:45.575 -> 
10:44:45.610 -> +CIPRCV:1344,HTTP/1.1 400 Bad Request
10:44:45.646 -> Server: nginx
10:44:45.646 -> Date: Sat, 23 Mar 2019 09:44:32 GMT
10:44:45.681 -> Content-Type: text/html
10:44:45.715 -> Connection: close
10:44:45.753 -> X-Host-Ip: 80
10:44:45.753 -> 
10:44:45.753 -> <html>
10:44:45.787 -> <head><title>400 Bad Request</title></head>
10:44:45.821 -> <body>
10:44:45.821 -> <center><h1>400 Bad Request</h1></center>
10:44:45.859 -> <hr><center>nginx</center>
10:44:45.859 -> <!--]--><div style="text-align:center;font-size:11px" class="cbalink"><a href="https://www.cba.pl/" title="darmowy hosting">Darmowy Hosting</a> CBA.PL<br/><br/></div>
10:44:46.077 -> <script type="text/javascript" src="//a5.cba.pl/r1.js"></script>
10:44:46.150 -> <div class="cumf_bt_form_wrapper" style="display:none">
10:44:46.188 -> <form id="contact_us_mail_feedback" action="/oldTi9QvqM6ytokU9Q8ylQq" method="post">
10:44:46.264 ->     <fieldset>
10:44:46.301 ->         <!-- Form Name -->
10:44:46.301 ->         <legend>Contact Us</legend>
10:44:46.338 ->         <!-- Text input-->
10:44:46.375 ->         <div class="cumf_bt_form-group">
10:44:46.445 ->             <label class="col-md-4 cumf_bt_control-label" for="cumf_bt_name">name</label>
10:44:46.516 ->             <div class="col-md-4">
10:44:46.586 ->                 <input id="cumf_bt_name" name="cumf_bt_name" type="text" placeholder="your name" class="cumf_bt_form-control cumf_bt_input-md" />
10:44:46.690 ->                 <span class="cumf_bt_help-block">Please enter your name</span>
10:44:46.796 ->             </div>
10:44:46.796 ->         </div>
10:44:46.834 ->         <!-- Text input-->
10:44:46.834 ->         <div class="cumf_bt_form-group">
10:44:46.906 ->             <label class="col-md-4 cumf_bt_control-label" for="cumf_bt_email">your email</label>
10:44:47.008 ->      
10:44:47.008 -> 
10:44:47.008 -> +CIPRCV:776,       <div class="col-md-4">
10:44:47.046 ->                 <input id="cumf_bt_email" name="cumf_bt_email" type="text" placeholder="enter your email" class="cumf_bt_form-control cumf_bt_input-md" />
10:44:47.190 ->                 <span class="cumf_bt_help-block">please enter your email</span>
10:44:47.298 ->             </div>
10:44:47.298 ->         </div>
10:44:47.333 ->         <!-- Textarea -->
10:44:47.366 ->         <div class="cumf_bt_form-group">
10:44:47.400 ->             <label class="col-md-4 cumf_bt_control-label" for="cumf_bt_message">your message</label>
10:44:47.508 ->             <div class="col-md-4">
10:44:47.543 ->                 <textarea class="cumf_bt_form-control" id="cumf_bt_message" name="cumf_bt_message">Message goes here</textarea>
10:44:47.684 ->             </div>
10:44:47.721 ->         </div>
10:44:47.721 ->         <input type="submit" id="cumf_bt_submit" value="Send"/>
10:44:47.756 ->     </fieldset>
10:44:47.789 -> </form>
10:44:47.789 -> </div></body>
10:44:47.789 -> </html>
10:44:47.827 -> 
10:44:47.827 -> 
10:44:47.827 ->
10:44:47.827 -> +TCPCLOSED:0
10:44:49.779 -> 
10:44:49.779 -> OK
10:44:51.787 -> ⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮
10:46:49.768 -> OK
 
Odpowiedź
  


Wiadomości w tym wątku
RE: GPRS Request HTTP - moduł A6 GSM/GPRS - ERROR z GET - przez kita007 - 23-03-2019, 12:08

Skocz do:


Przeglądający: 1 gości