-->
Page 2 of 2

Re: Self-localization using the Google Maps API

PostPosted: Sun Feb 26, 2017 12:41 am
by rudy
gdsports wrote:Very cool!

Working after one change. I was getting 444 response code.

Code: Select all    client.print("Content-Length: ");
    client.println(data.length());
    client.println();
    client.println(data);


Change
Code: Select allclient.println(data)
to
Code: Select allclient.print(data)
println adds end of line characters so the extra chars throws off the content length.


I gave that a try and still no go.

Re: Self-localization using the Google Maps API

PostPosted: Sun Feb 26, 2017 3:54 am
by martin_g
Error code 444 means, that the HTTPS request has failed, probably timed out. You might test the logic of the program by sending the JSON structure direcly to Google: just copy it into a file and send (with Linux):

Code: Select all$ curl -d @your_filename.json -H "Content-Type: application/json" -i "https://www.googleapis.com/geolocation/v1/geolocate?key=YOUR_API_KEY"


If this works, you (and I) probably need a more robust implementation of an HTTPS request - anything out there?

Re: Self-localization using the Google Maps API

PostPosted: Sun Feb 26, 2017 7:48 am
by rudy
I had thought of that. Unfortunately I have Windows. I'll take a look for something I could use.

I did try increasing the timeout but that didn't help.

Re: Self-localization using the Google Maps API

PostPosted: Sun Feb 26, 2017 6:46 pm
by martin_g
Updated the https_post(). Seems to be reliable for me. Hope, this does the job for you as well...