Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


another json problem.

another json problem.

another json problem.

hello everyone. im not a professional PHP programmer. but im practicing some skill working with an api(https://api.icowatchlist.com/public/v1/) using php to call and display data that is stored in json on my localhost(wampserver).
my codes are these:
$url = "https://api.icowatchlist.com/public/v1/";
$get= file_get_contents($url);
$decode= json_decode($get, true);
echo $decode['ico']['live']['name'];

when i run it the error does:
Notice: Undefined index: name in C:\wamp64\www...

please can someone tell me what i have done wrong,or what i have to do. what i wanted is to display the datas in tabular manner.
thank you

RE: another json problem.

The ['live'] index is an array of elements. each element then has a ['name'] element inside. But there is no ['name'] index directly under ['live'] so you need to specify which element in the ['live'] array you want the name for.

You would need to do something like: $decode['ico']['live'][x]['name'];

Where "x" is a number between 0 and apparently 277.

If you are unsure of what the structure of the array looks like, its always helpful to print it out entirely in a structured form to be able to see it.

echo "<pre>" . print_r($decode,1) . "</pre>";

Phil AKA Vacunita
OS-ception: Running Linux on a Virtual Machine in Windows which itself is running in a Virtual Machine on Mac OSx.

Web & Tech

RE: another json problem.

thnak you Vaunita !
i helped by you

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close