MyBB Community Forums

Full Version: Integrate external avatars
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey all,

I have a question i have this code:

<?php
$charname = $_POST["cname"]; //input character name
$realmname = $_POST["rname"]; //input realm name
$charurl = urlencode($charname); //prepares character name for url usage
$realmurl = 'http://eu.battle.net/api/wow/character/'.$realmname.'/';  //combines the basic url link with the realm name
$toon = $realmurl.$charurl //adds the charactername behind the realm url
$data = file_get_contents($toon); //retrieves the data from the armory api
$obj = json_decode($data);?> <!--converts the data from json to be used in the php code--> 
<a href="http://eu.battle.net/static-render/eu/<?php echo $obj->thumbnail; ?>"> </a><br />  <!-- Is url link to image-->

To get the data from the wow-armory to retrieve the thumbnail(avatar) which works. But now is my question how do i integrate this into my forum. I want this to be an option visible on the change avatar page.
In the form of:
Armory Avatar      --   Character Name: (cname)
                         Realm Name:  (rname)
Which when the form is filled in ( cname/rname ) returns the URL for the image (after hitting submit). And changes your avatar to that URL.

Any help would be greatly appreciated
Hello

Did you every get this fixed?
I am looking for this for my website.
(2013-11-08, 02:10 PM)SKULL Wrote: [ -> ]Hello

Did you every get this fixed?
I am looking for this for my website.

I did, though the implementation method is completely different.
Not exactly sure how but i used a popup (with a link to a php file in which users could specify there char name and realm upon which it retrieved the url closed the popup and inserted the url into the avatar URL thingie.