0

http://roblox.plus:2052/inventory?username=joxxi

It shows one big long array.

The first part is:

{"id":107484852,"username":"Joxxi","bc":"BC","rap":643

how do I like ignore everything but the 643

I am using the api in a php script like this:

echo "<td><object height='20' width='100' data='http://roblox.plus:2052/inventory?username=".$row['username']."'/></td>";

right now its just echoing the array

3 Answers3

0

Try file_get_contents

$page = file_get_contents('http://roblox.plus:2052/inventory?username='.$row['username']);
echo json_decode($page,true)['rap'];
madalinivascu
  • 32,064
  • 4
  • 39
  • 55
0

Simple do

$result = file_get_contents('http://roblox.plus:2052/inventory?username=joxxi');

Then transform result into associative array

$row = json_decode($result, true);

Later you can echo but before make sure row is not a collection of array if so return first one

if (count ($row)) {
    $row = $row[0];
}
echo $row['rap']

Hope it helps

Marcel Djaman
  • 1,276
  • 1
  • 17
  • 34
0

I've also noticed there is a difference in execution time comparing curl and file_get_contents. You can also use below curl code to get the desired data.

$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, 'http://roblox.plus:2052/inventory?username=joxxi');
$resultCurl = curl_exec($ch);
$obj = json_decode($resultCurl);
echo $obj->rap;
JiteshNK
  • 428
  • 2
  • 11