1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Instagram PHP and Json decode

Discussion in 'Instagram' started by jlc17, Feb 10, 2016.

  1. jlc17

    jlc17 Newbie

    Joined:
    Nov 17, 2015
    Messages:
    7
    Likes Received:
    0
    Hello I'm trying to build a PHP app using Json decode to get all the Instagram recent data. I can get almost all the posts info, but the users tagged in the photo is not working, please check the examples:

    1. Example that works:

    Json:

    "link": "................",
    "likes": {
    "count": 869,
    "data": [
    {
    "username": "alucena03",
    "profile_picture": "............12357762_502957436496239_1249144480_a.jpg",
    "id": "2360193393",
    "full_name": "gabriel alejandro"
    }


    PHP - it gets the links and the likes count with no problem:

    $link = $vm["link"];
    $likes = $vm['likes']['count'];


    2. Example that don't work -PELASE HELP - GET USERS_IN_PHOTO:

    Jason that I want to get:

    "users_in_photo": [
    {
    "position": {
    "y": 0.03670266,
    "x": 0.03668111
    },
    "user": {
    "username": "retratosvzla",
    "profile_picture": "..................../t51.2885-19/s150x150/10522832_873539719420276_688293547_a.jpg",
    "id": "589009961",
    "full_name": "Rene Flores"
    }
    }

    ]
    ,


    PHP - That diren't work:

    $userinphoto = $vm['users_in_photo']['user']['username'];

    i am trying to get the username



    Please any help would be very helpful! Thanks!
     
    Last edited: Feb 10, 2016
  2. cpainvest

    cpainvest Registered Member

    Joined:
    Feb 2, 2011
    Messages:
    91
    Likes Received:
    8
    Occupation:
    Google Dev
    "users_in_photo" is a array
    You shound try $userinphoto = $vm['users_in_photo'][0]['user']['username'];
     
    • Thanks Thanks x 1