-2

I am retrieving a huge string from the WoW Armory API using:

$allAchievements = file_get_contents('http://us.battle.net/api/wow/data/character/achievements');

That returns this:

http://us.battle.net/api/wow/data/character/achievements

I am trying to convert this into a manageable format such as an array that would look similar to:

[achievements]=> array
             (
            [0]=> Array 
               (
                [id]=>6, 
                [title]=>Level 10, 
                [points]=>10, 
                [description]=>Reach Level 10.,
                [rewardItems]=>[],
                [icon]=>achievement_level_10,
                [criteria]=>[],
                [accountWide]=>false,
                [factionId]=>2,
                )
            [1]=> Array 
               (
                [id]=>7, 
                [title]=>Level 20, 
                [points]=>10, 
                [description]=>Reach Level 20.,
                [rewardItems]=>[],
                [icon]=>achievement_level_20,
                [criteria]=>[],
                [accountWide]=>false,
                [factionId]=>2,
                ) 
               ... 
              )

I have tried numerous combinations of explode() and parse_str() but i haven't been able to create any kind of array that would prove to be any use to me.

Is there a way to use file_get_contents(); so that a array would be returned in stead of a string?

If not, where should i start to expand this huge string into a manageable array?

Thank You for any help!

1 Answer 1

1

use this

$allAchievements = file_get_contents('http://us.battle.net/api/wow/data/character/achievements');
$newArray = json_decode($allAchievements, true);
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.