1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How do I grab a specific entry based on one value from array?

Discussion in 'Programming' started by rebelagent, Aug 9, 2012.

  1. #1
    I've been trying to scrape json data from a remote URL (another site from a game) and I can't seem to figure this bit out

    The json data is structured like

    TotalPoints
    TotalGroups
    GroupStandings
    --RANK -> 1
    --POINTS ->123,123,120
    --GroupName ->AlphaDogs
    --GroupID -> 12348

    --RANK -> 2
    --POINTS -> 123,120
    --GroupName ->OmegaDogs
    --GroupID -> 40534

    I need to grab the entire entry from 'Rank' to 'GroupName' based on the group ID I enter into my script.
    Can anyone help me or guide me?

    Been going crazy over this. I want to do this with just php but if I can't do i need to look into javascript or json?
     
    rebelagent, Aug 9, 2012 IP
  2. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #2
    Rukbat, Aug 10, 2012 IP
  3. rebelagent

    rebelagent Well-Known Member

    Messages:
    876
    Likes Received:
    46
    Best Answers:
    0
    Trophy Points:
    165
    #3
    sorry meant to say that I converted the json to an array. But I'm also able to just define some parts to get exactly what I need without making it an array.

    I figured more people are familiar with arrays and so I'd be able to get a faster answer if I said Array in the title and displayed my data as an array.


    I can grab GroupStandings and list them as an array or list just 1 according to the number it is in the array [0] [1] [2] but this will always change in the json data so I need to be able to grab the data via a value like the GroupName or GroupID and desplay the entire entry for just one group.
     
    Last edited: Aug 10, 2012
    rebelagent, Aug 10, 2012 IP