# How to get all content from API using cURL

**URL:** <https://www.phphelp.com/t/how-to-get-all-content-from-api-using-curl/36355>\
**Category:** General PHP Help\
**Created:** [December 30, 2024, 7:02am UTC](https://www.phphelp.com/t/how-to-get-all-content-from-api-using-curl/36355 "2024-12-30T07:02:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![temceo](https://www.phphelp.com/letter_avatar_proxy/v4/letter/t/9e8a1a/32.png) [@temceo](https://www.phphelp.com/u/temceo)\
**Post date:** [December 30, 2024, 7:03am UTC](https://www.phphelp.com/t/how-to-get-all-content-from-api-using-curl/36355/1 "2024-12-30T07:03:00Z")

</div>

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](https://github.com/Temceo/php_test/tree/main)

Any guidance will be appreciated.

Thanks

---

<div class="post-metadata">

**Author:** ![phdr](https://www.phphelp.com/letter_avatar_proxy/v4/letter/p/91b2a8/32.png) [@phdr](https://www.phphelp.com/u/phdr)\
**Post date:** [December 30, 2024, 9:32am UTC](https://www.phphelp.com/t/how-to-get-all-content-from-api-using-curl/36355/2 "2024-12-30T09:32:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![temceo](https://www.phphelp.com/letter_avatar_proxy/v4/letter/t/9e8a1a/32.png) [@temceo](https://www.phphelp.com/u/temceo)\
**Post date:** [December 30, 2024, 10:29am UTC](https://www.phphelp.com/t/how-to-get-all-content-from-api-using-curl/36355/3 "2024-12-30T10:29:32Z")

</div>

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

 ![image](https://www.phphelp.com/uploads/default/original/2X/d/deb47ecb67f4161dbcbab06f0dca683c3068a808.png)

---

<div class="post-metadata">

**Author:** ![temceo](https://www.phphelp.com/letter_avatar_proxy/v4/letter/t/9e8a1a/32.png) [@temceo](https://www.phphelp.com/u/temceo)\
**Post date:** [December 30, 2024, 10:30am UTC](https://www.phphelp.com/t/how-to-get-all-content-from-api-using-curl/36355/4 "2024-12-30T10:30:07Z")

</div>

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

 ![image](https://www.phphelp.com/uploads/default/original/2X/e/e4027bd5acfc2fa9359dccd6c18668aa53ffe6bc.png)

---

<div class="post-metadata">

**Author:** ![temceo](https://www.phphelp.com/letter_avatar_proxy/v4/letter/t/9e8a1a/32.png) [@temceo](https://www.phphelp.com/u/temceo)\
**Post date:** [December 30, 2024, 10:55am UTC](https://www.phphelp.com/t/how-to-get-all-content-from-api-using-curl/36355/5 "2024-12-30T10:55:08Z")

</div>

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:

 ![image](https://www.phphelp.com/uploads/default/original/2X/0/06e8ca11eca58bba0b6d3515c8dad260a7bb9a57.png)

Thanks for your help
