Showing Posts For JonnyTen.9428:

Super Adventure Box - 3D Fan art

in Community Creations

Posted by: JonnyTen.9428

JonnyTen.9428

Last Sunday I sat down to create some art, which unexpectedly turned into a SAB homage. Hope you enjoy!

You can see it in action here:
https://www.youtube.com/watch?v=nev5ip6-Dx0

Attachments:

PHP example

in API Development

Posted by: JonnyTen.9428

JonnyTen.9428

Here’s something extremely simple for the curious PHP beginners that simply want a quick result. Wouldn’t recommend building on this method though:


function getItem($id) {
$response = file_get_contents(“https://api.guildwars2.com/v1/item_details.json?item_id=”.$id);
$response = json_decode($response, false);

return $response;
}

//Use as following:
echo getItem(12345)->name;

Alternatively I use the HttpRequest class


function getItem($id)
{
$req = new HttpRequest(‘https://api.guildwars2.com/v1/item_details.json’, HttpRequest::METH_GET);

//Add GET values, in this case just the item_id and language
$req->addQueryData(array(
‘item_id’ => $id,
‘lang’ => ‘en’
));

try {
//Sends it and fills $result Object
$result = $req->send();

//If any errors
} catch (HttpException $ex) {
echo $ex;
}

return ($result);


}

print_r(getItem(12345));

(edited by JonnyTen.9428)