Does anyone know how about to get top 3 items in item market? For instance the top 3 bazaars for item such as Donator pack/
PHP/HTML API Tutorial
Started by AAW [1525734] on in API Development.
Posts archived: 26 / 26 posts (100%) · the total is Torn's reply count + the opening post at the last fetch
Does anyone know how about to get top 3 items in item market? For instance the top 3 bazaars for item such as Donator pack/
I get the following error using your post aaw
Fatal error: Cannot use object of type stdClass as array in /home2/stats.php on line 10
Line 10 being: echo "Energy=" . $obj['energy']['current'];
it works with me so your not using the json_decode($stringhere, true);
what i wanted to do AAW, was make a form where you enter your api key and have itsend over to the php "$json =file_get_contents("http://api.torn.com/user/?selections=Bars,money&key=J2fIt");"
and Metzen, it works for me on my localhost server (using xampp)
okay, so i'm trying to get the personal stats to work while trying to only select one part from personal stats... $json =file_get_contents("http://api.torn.com/user/?selections=Bars,money,money,personalstats&key=*key is provided*");
<?php
echo "money mugged=$" . $obj->moneymugged;
?>
This should work, haven't tested though.
<?php
$apibase = "http://api.torn.com/user/?selections=profile,basic,icons,networth,bazaar,display,personalstats&key=".$apiKey;
$response = file_get_contents($apibase);
$outputPublic = json_decode($response, true);
$userArray=Array($outputPublic["personalstats"]); $moneyMugged=number_format($userArray[0]["moneymugged"]);print_r("$".$moneyMugged);
?>