How to get all content from API using cURL

Hi
I am trying to get show the results of a post request (latitude / longitude) from an api call to show on an html page. The data is posted in jQuery and passed on to a php server which makes a call to the api to retrieve the data and pass back to the html page.

I am successfully retrieving the data, but hit an error on the php file (line 34 - undefined array key). I am struggling to overcome this error and would appreciate on fixing the issue. I have uploaded all the files to this github repository - GitHub - Temceo/php_test

Any guidance will be appreciated.

Thanks

Have you examined the data to see if it contains a ‘timezone’ element?

Hi have removed lines 34 and 36 in php and can successfully send the data to the html page

But I am getting the json parsing error below. I cannot yet identify the source of the syntax error.

Hi, I have resolved this. I am exporting the result direct from php as a string to jQuery and using JSON.parse to turn into an object:

Thanks for your help

Sponsor our Newsletter | Privacy Policy | Terms of Service