Im having trouble getting a successful HTTP GET request to a domain under 000webhost.com
I am trying to do a GET request which sends data to a php file on my domain and save it to MySQL database. I also did this first on my browser and it works fine so I don't think there are problem in my php file.
MY DOMAIN: wastedb.000webhostapp.com
But if I try to send a request to dweet.io, it works as expected.
I am using a modified version of Adafruit_FONA library and will post the code snippet and response from serial monitor below.
Here are the parameters that I used for the WORKING GET request:
Host Address: www.dweet.io
Host: dweet.io
Response from Serial monitor for dweet.io (working):
---> AT+CHTTPSSTART
<--- OK
---> AT+CHTTPSOPSE="www.dweet.io",80,1
<--- OK
---> AT+CHTTPSSEND=64
<--- >
---> GET /dweet/for/gearhead?hello=world HTTP/1.1
Host: dweet.io
<--- OK
---> AT+CHTTPSSEND
<--- OK
<--- +CHTTPSSEND: 0
---> AT+CHTTPSRECV?
<--- +CHTTPSRECV: LEN,361
---> AT+CHTTPSRECV=361
<--- OK
+CHTTPSRECV: DATA,361
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Date: Wed, 30 Jan 2019 00:16:43 GMT
Connection: keep-alive
Content-Length: 196
{"this":"succeeded","by":"dweeting","the":"dweet","with":{"thing
---> AT+CHTTPSCLSE
<--- OK
---> AT+CHTTPSSTOP
<--- OK
As we can see, the Arduino received a JSON response from the website.
Here are the parameters that I used for the NOT WORKING GET request:
Host Address: wastedb.000webhostapp.com
Host: wastedb.000webhostapp.com
Response from Serial monitor for wastedb.000webhostapp.com (NOT WORKING):
---> AT+CHTTPSSTART
<--- OK
---> AT+CHTTPSOPSE="wastedb.000webhostapp.com",80,1
<--- OK
---> AT+CHTTPSSEND=113
<--- >
---> GET /wastedb/get_location.php?lat=14.640155&lon=120.974920&stat=LOW HTTP/1.1
Host: wastedb.000webhostapp.com
<--- OK
---> AT+CHTTPSSEND
<--- ERROR
Am I missing something here? Seems like the shield cannot find the Host Server I provided for my website.
EDIT: It is working now. The only solution that worked for me is to find another hosting site.