HL7692 TCP client example: how to make http get request to google

sierra_airprime_hl76xx_at_commands_interface_guide_rev6_2.pdf (2.9 MB)

Following the example on page 363, i get this:
AT+KCNXCFG=1,“GPRS”,“www.internet.mtelia.dk”

OK // APN config

AT+KTCPCFG=1,0,“www.google.com”,80

+KTCPCFG: 1

OK
AT+KTCPCNX=1

OK

+KCNX_IND: 1,4,1

+KCNX_IND: 1,1,0

+KTCP_IND: 1,1 //session is set up and ready for operation

AT+KTCPSND=1,18 // send 18 characters

CONNECT
// send get request
“GET/HTTP / 1.1

–EOF–Pattern–”
// modem answer:
NO CARRIER

+KTCP_NOTIF: 1,8 // Data sending is OK but KTCPSND was waiting more or less characters
+KTCP_DATA: 1,1360 // recieved data from google

+KTCP_DATA: 1,352

+KTCP_NOTIF: 1,4 // TCP disconnection by the server or remote client

AT+KTCPRCV=1, 1380

CONNECT
HTTP/1.0 400 Bad Request
Content-Type: text/html; charset=UTF-8
Referrer-Policy: no-referrer
Content-Length: 1555
Date: Fri, 08 Nov 2019 12:21:33 GMT

Error 400 (Bad Request)!!1 **ETC**--EOF--Pattern-- OK

AT+KTCPRCV=1, 1380 // get data

CONNECT

Your client has issued a malformed or illegal request That’s all we know. --EOF--Pattern-- OK

I can not seem to figure out, how to write the get request successfully. At least i think that’s the problem.

Hi,
Which firmware are you using?
I can make http get request to google successfully on HL7692 FW RHL769x.2.23.172400.201706231140.x7120m_1
You can try some steps in my log file.Log and script.zip (21.4 KB)

(18:41:29:139) Snd COM124 [AT+KTCPCFG=1,0,“www.google.com”,80]
(18:41:29:143) Rcv COM124 [+KTCPCFG: 1] @ 1<3000 ms
(18:41:29:149) Rcv COM124 [OK] @ 0<3000 ms
Start TCP Connection…
(18:41:29:357) Snd COM124 [AT+KTCPCNX=1]
(18:41:29:365) Rcv COM124 [OK] @ 1<3000 ms
(18:41:29:375) Rcv COM124 [+KCNX_IND: 1,4,1]
(18:41:30:142) Rcv COM124 [+KCNX_IND: 1,1,0]
(18:41:30:527) Rcv COM124 [+KTCP_IND: 1,1] @ 1153<60000 ms

Send data to HTTP server …
(18:41:30:735) Snd COM124 [AT+KTCPSND=1,19]
(18:41:30:740) Rcv COM124 [CONNECT] @ 1<3000 ms
(18:41:30:945) Snd COM124 [GET / HTTP/1.1]
(18:41:31:156) Snd COM124 [–EOF–Pattern–]

Check the received URC
(18:41:31:223) Rcv COM124 [+KTCP_DATA: 1,1400] @ 48<30000 ms

The connection should be reset by HTTP server…
(18:41:31:231) Rcv COM124 [+KTCP_DATA: 1,1400]
(18:41:31:234) Rcv COM124 [+KTCP_DATA: 1,1400]
(18:41:31:238) Rcv COM124 [+KTCP_DATA: 1,1400]
(18:41:31:243) Rcv COM124 [+KTCP_DATA: 1,1400]
(18:41:31:251) Rcv COM124 [+KTCP_DATA: 1,1400]
(18:41:31:256) Rcv COM124 [+KTCP_DATA: 1,1400]
(18:41:31:260) Rcv COM124 [+KTCP_DATA: 1,1400]
(18:41:31:263) Rcv COM124 [+KTCP_DATA: 1,1400]
(18:41:31:266) Rcv COM124 [+KTCP_DATA: 1,1400]
(18:41:31:272) Rcv COM124 [+KTCP_DATA: 1,35194]
(18:41:31:276) Rcv COM124 [+KTCP_NOTIF: 1,4] @ 46<30000 ms

Receive data with max number…
(18:41:31:485) Snd COM124 [AT+KTCPRCV=1,4294967295]
(18:41:31:736) Rcv COM124 [CONNECT] @ 243<3000 ms
(18:41:31:741) Rcv COM124 [HTTP/1.1 200 OKDate: Mon, 11 Nov 2019 11:41:30 GMT]
(18:41:31:744) Rcv COM124 [Expires: -1Cache-Control: private, max-age=0]
(18:41:31:748) Rcv COM124 [Content-Type: text/html; charset=ISO-8859-1P3P: CP=“This is not a P3P policy! See g.co/p3phelp for more info.”]
(18:41:31:751) Rcv COM124 [Server: gwsX-XSS-Protection: 0]