have tried playing around with the fona library from adafruit
in example LTE_demo have changed line 1037 -> 1057
#else
// Construct the appropriate URL's and body, depending on request type
// Use IMEI as device ID for this example
// GET request
sprintf(URL, "dweet.io/dweet/for/%s?temp=%s&batt=%i", imei, tempBuff, battLevel); // No need to specify http:// or https://
// sprintf(URL, "http://dweet.io/dweet/for/%s?temp=%s&batt=%i", imei, tempBuff, battLevel); // But this works too
if (!fona.postData("GET","script.google.com/macros/s/AKfycbzZxVDqD5KqSsrS605ROUGZ7IaeFyB9_vlWviwSWO21s7UotwNF4EQbg43iLcbLVHLWdA/exec?temperature=10" ))
Serial.println(F("Failed to complete HTTP GET..."));
// POST request
/*
sprintf(URL, "http://dweet.io/dweet/for/%s", imei);
sprintf(body, "{\"temp\":%s,\"batt\":%i}", tempBuff, battLevel);
if (!fona.postData("POST", URL, body)) // Can also add authorization token parameter!
Serial.println(F("Failed to complete HTTP POST..."));
*/
#endif
see my serial monitor:
-------------------------------------
[?] Print this menu
[a] Read the ADC; 2.8V max for SIM800/808, 0V-VBAT for SIM7000 shield
[b] Read supply voltage
[C] Read the SIM CCID
[U] Unlock SIM with PIN code
[i] Read signal strength (RSSI)
[n] Get network status
[1] Get network connection info
[c] Make phone Call
[A] Get call status
[h] Hang up phone
[p] Pick up phone
[N] Number of SMS's
[r] Read SMS #
[R] Read all SMS
[d] Delete SMS #
[s] Send SMS
[u] Send USSD
[y] Enable local time stamp (SIM800/808/70X0)
[Y] Enable NTP time sync (SIM800/808/70X0)
[t] Get network time
[G] Enable cellular data
[g] Disable cellular data
[l] Query GSMLOC (2G)
[w] Read webpage
[W] Post to website
[2] Post to dweet.io - 2G / LTE CAT-M / NB-IoT
[3] Post to dweet.io - 3G / 4G LTE
[O] Turn GPS on (SIM808/5320/7XX0)
[o] Turn GPS off (SIM808/5320/7XX0)
[L] Query GPS location (SIM808/5320/7XX0)
[E] Raw NMEA out (SIM808)
[S] Create serial passthru tunnel
-------------------------------------
FONA> 2
---> AT+CBC
<--- +CBC: 0,66,3860
---> AT+HTTPTERM
<--- ERROR
---> AT+HTTPINIT
<--- OK
---> AT+HTTPPARA="CID",1
<--- OK
---> AT+HTTPPARA="URL","script.google.com/macros/s/AKfycbzZxVDqD5KqSsrS605ROUGZ7IaeFyB9_vlWviwSWO21s7UotwNF4EQbg43iLcbLVHLWdA/exec?temperature=10"
<--- OK
---> AT+HTTPACTION=0
<--- OK
HTTP status: 601
Data length: 0
Failed to complete HTTP GET...
Hi there
got a bit further My previous mistake was i didn't switch on the gprs now I did but end up with http error 301 page permantly moved. see serial output :
---> AT+CGREG?
<--- +CGREG: 0,1
Network status 1: Registered (home)
FONA> G
---> AT+CIPSHUT
<--- SHUT OK
---> AT+CGATT=1
<--- OK
---> AT+SAPBR=3,1,"CONTYPE","GPRS"
<--- OK
---> AT+SAPBR=3,1,"APN","my apn"
<--- OK
---> AT+CSTT="my apn"
<--- OK
---> AT+SAPBR=1,1
<--- OK
---> AT+CIICR
<--- OK
FONA> 2
---> AT+CBC
<--- +CBC: 0,66,3865
---> AT+HTTPTERM
<--- ERROR
---> AT+HTTPINIT
<--- OK
---> AT+HTTPPARA="CID",1
<--- OK
---> AT+HTTPPARA="URL","http://script.google.com/macros/s/AKfycbzZxVDqD5KqSsrS605ROUGZ7IaeFyB9_vlWviwSWO21s7UotwNF4EQbg43iLcbLVHLWdA/exec?temperature=10"
<--- OK
---> AT+HTTPACTION=0
<--- OK
HTTP status: 301
Data length: 311
Failed to complete HTTP GET...
read somewhere that has to do with https
client is not sending a User-Agent header in the request, so Google knows your client is not a browser, and might not be issuing the redirect in your case. But in a real browser, it does
Since you are not hiring me on Guru, I'll give you a FREE solution here itself.
You need to mention https:// before the URL
So
// GET request
sprintf(URL, "https://dweet.io/dweet/for/%s?temp=%s&batt=%i", imei, tempBuff, battLevel); // need to specify http:// or https://
if (!fona.postData("GET","https://script.google.com/macros/s/AKfycbzZxVDqD5KqSsrS605ROUGZ7IaeFyB9_vlWviwSWO21s7UotwNF4EQbg43iLcbLVHLWdA/exec?temperature=10" ))
Serial.println(F("Failed to complete HTTP GET..."));
thank you so much, have tried but now error 601 see serial below:
-------------------------------------
[?] Print this menu
[a] Read the ADC; 2.8V max for SIM800/808, 0V-VBAT for SIM7000 shield
[b] Read supply voltage
[C] Read the SIM CCID
[U] Unlock SIM with PIN code
[i] Read signal strength (RSSI)
[n] Get network status
[1] Get network connection info
[c] Make phone Call
[A] Get call status
[h] Hang up phone
[p] Pick up phone
[N] Number of SMS's
[r] Read SMS #
[R] Read all SMS
[d] Delete SMS #
[s] Send SMS
[u] Send USSD
[y] Enable local time stamp (SIM800/808/70X0)
[Y] Enable NTP time sync (SIM800/808/70X0)
[t] Get network time
[G] Enable cellular data
[g] Disable cellular data
[l] Query GSMLOC (2G)
[w] Read webpage
[W] Post to website
[2] Post to dweet.io - 2G / LTE CAT-M / NB-IoT
[3] Post to dweet.io - 3G / 4G LTE
[O] Turn GPS on (SIM808/5320/7XX0)
[o] Turn GPS off (SIM808/5320/7XX0)
[L] Query GPS location (SIM808/5320/7XX0)
[E] Raw NMEA out (SIM808)
[S] Create serial passthru tunnel
-------------------------------------
FONA> i
---> AT+CSQ
<--- +CSQ: 25,99
RSSI = 25: -64 dBm
FONA> n
---> AT+CGREG?
<--- +CGREG: 0,1
Network status 1: Registered (home)
FONA> 2
---> AT+CBC
<--- +CBC: 0,66,3861
---> AT+HTTPTERM
<--- ERROR
---> AT+HTTPINIT
<--- OK
---> AT+HTTPPARA="CID",1
<--- OK
---> AT+HTTPPARA="URL","https://script.google.com/macros/s/AKfycbzZxVDqD5KqSsrS605ROUGZ7IaeFyB9_vlWviwSWO21s7UotwNF4EQbg43iLcbLVHLWdA/exec?temperature=10"
<--- OK
---> AT+HTTPACTION=0
<--- OK
HTTP status: 601
Data length: 0
---> AT+HTTPREAD
<--- OK
<---
---> AT+HTTPTERM
<--- OK
FONA> ```
[?] Print this menu
[a] Read the ADC; 2.8V max for SIM800/808, 0V-VBAT for SIM7000 shield
[b] Read supply voltage
[C] Read the SIM CCID
[U] Unlock SIM with PIN code
[i] Read signal strength (RSSI)
[n] Get network status
[1] Get network connection info
[c] Make phone Call
[A] Get call status
[h] Hang up phone
[p] Pick up phone
[N] Number of SMS's
[r] Read SMS #
[R] Read all SMS
[d] Delete SMS #
[s] Send SMS
[u] Send USSD
[y] Enable local time stamp (SIM800/808/70X0)
[Y] Enable NTP time sync (SIM800/808/70X0)
[t] Get network time
[G] Enable cellular data
[g] Disable cellular data
[l] Query GSMLOC (2G)
[w] Read webpage
[W] Post to website
[2] Post to dweet.io - 2G / LTE CAT-M / NB-IoT
[3] Post to dweet.io - 3G / 4G LTE
[O] Turn GPS on (SIM808/5320/7XX0)
[o] Turn GPS off (SIM808/5320/7XX0)
[L] Query GPS location (SIM808/5320/7XX0)
[E] Raw NMEA out (SIM808)
[S] Create serial passthru tunnel
-------------------------------------
FONA> i
---> AT+CSQ
<--- +CSQ: 20,99
RSSI = 20: -74 dBm
FONA> n
---> AT+CGREG?
<--- +CGREG: 0,1
Network status 1: Registered (home)
FONA> G
---> AT+CIPSHUT
<--- SHUT OK
---> AT+CGATT=1
<--- OK
---> AT+SAPBR=3,1,"CONTYPE","GPRS"
<--- OK
---> AT+SAPBR=3,1,"APN","net.hotm"
<--- OK
---> AT+CSTT="net.hotm"
<--- OK
---> AT+SAPBR=1,1
<--- OK
---> AT+CIICR
<--- OK
FONA> 2
---> AT+CBC
<--- +CBC: 0,66,3864
---> AT+HTTPTERM
<--- ERROR
---> AT+HTTPINIT
<--- OK
---> AT+HTTPPARA="CID",1
<--- OK
---> AT+HTTPPARA="URL","https://script.google.com/macros/s/AKfycbzZxVDqD5KqSsrS605ROUGZ7IaeFyB9_vlWviwSWO21s7UotwNF4EQbg43iLcbLVHLWdA/exec?temperature=10"
<--- OK
---> AT+HTTPACTION=0
<--- OK
HTTP status: 603
Data length: 0
---> AT+HTTPREAD
<--- OK
<---
---> AT+HTTPTERM
<--- OK