Hi there I'm currently using an API built to scrape prices out of an MMO and display them in an array. At the moment this is my code:
<?php
ini_set('max_execution_time', 0);
$data = json_decode(file_get_contents("http://www.gw2spidy.com/api/v0.9/json/all-items/all"), true);
foreach($data as $item) {
echo '<pre>';
print_r($data);
echo '</pre>';
}
?>
This returns a MASSIVE array. I saved the html file and it's around 35 megabytes. It has every single price of every single item etc... Okay so basically what I need is to search for an item such as 'Dusk' or by it's itemID '29185'. The prices and array keys change every hour so I've been trying to figure out a dynamic way of extracting this data every time but I'm stumped...
The arrays are structured like:
Array
(
[count] => 19959
[results] => Array
(
[15875] => Array
(
[data_id] => 29185
[name] => Dusk
[rarity] => 5
[restriction_level] => 80
[img] => https://dfach8bufmqqv.cloudfront.net/gw2/img/content/fabc9042.png
[type_id] => 18
[sub_type_id] => 6
[price_last_changed] => 2012-12-03 08:30:49 UTC
[max_offer_unit_price] => 3180000
[min_sale_unit_price] => 3890000
[offer_availability] => 5574
[sale_availability] => 6
[gw2db_external_id] => 63505
[sale_price_change_last_hour] => 0
[offer_price_change_last_hour] => 0
)
If anyone can point me in the right direction that would be awesome! I have searched for days and days but can't figure it out... I bet you it's really simple too :(