Skip to content
Advertisement

PHP Notice: Trying to get property ‘id’ of non-object. How to resolve?

I am using cURL and PHP to make a request to a test API to return a list of users but I get the following error:

PHP Notice: Trying to get property ‘id’ of non-object

Not sure where I am going wrong.

Here is my code

JavaScript

Advertisement

Answer

you have to loop through the response:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement