0

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.

  • Please consider answering your own question with the information in your "edit". After a day or two, you can accept your answer as the solution. – VE7JRO May 29 at 16:54
2

Try just using IP address for the Host line instead. I did the same thing for POST and it works fine for me.

Example:

Host: 13.xxx.xx.xx

sucessful POST

-1

It is working now. The only solution that worked for me is to find another hosting site.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.