Code snaps to help you in the api!

#1 - Aug. 11, 2011, 4:38 p.m.
Blizzard Post
so i have neerly finished my php-api and thought id help some people out

this is a function i use to get a well formed url for my script rather then having to code a url all the time i pass bits of data and get a full return


/*
@ui the battle.net region url
@class is the type of data being asked for character,status,team ...
@server wow realm name (url functions removes ' and replaces + with %20 as per blizzard url settings)
@name ither character team or guild names
@fields this is optional data you wana pass along to the url fields or multiple realm names
!q returnd fuly formed url for the api
*/
function BuildUrl($ui,$class,$server,$name,$fields)
{
$name = str_replace('+' , '%20' , urlencode($name));
$server = strtolower(str_replace("\'" , '' ,$server));
$server = str_replace('+' , '%20' , urlencode($server));
switch ($class)
{
case 'character':
// /api/wow/character/{realm}/{name}
$q = 'api/wow/character/'.$server.'/'.$name.$fields['data'].'';
break;

case 'status':
$q = 'api/wow/realm/status?'.$fields['data'].'';
break;

case 'guild':
// /api/wow/guild/{realm}/{name}
$q = 'api/wow/guild/'.$server.'/'.$name.'/'.$fields['data'].'';
break;

case 'team':
// /api/wow/arena/{realm}/{size}/{name} (size being 2v2, 3v3 or 5v5)
$q = 'api/wow/arena/'.$server.'/'.$field['data'].'/'.$name.'';
break;

case 'item':
#api/wow/data/item/38268
$q = 'api/wow/item/'.$name;
break;

case 'gperks':
$q = 'api/wow/data/guild/perks';
break;

case 'gachievments':
$q = 'api/wow/data/guild/perks';
break;

case 'grewards':
$q = 'api/wow/data/guild/rewards';
break;

case 'races':
$q = 'api/wow/data/character/races';
break;

case 'achievement':
$q = 'api/wow/data/achievement/'.$name.'';
break;

default:
$q = '';
break;
}

return $q;
}


Ial continue to post more code to help anyone out
Forum Avatar
Web & Mobile Team
#4 - Aug. 11, 2011, 4:56 p.m.
Blizzard Post
Is all of this available on GitHub?
Forum Avatar
Support Forum Agent
#15 - Aug. 11, 2011, 5:05 p.m.
Blizzard Post
Running in OpenGL is just a temporary step to see if the game continues to crash or not, as this will help us determine whether it's video-related.

A couple other things to do are:

1. Install the latest chipset drivers and BIOS for your motherboard. These can be found at the website of its manufacturer.

2. Rum Memtest86+ (http://www.memtest.org) overnight to see if it finds RAM-related errors.
________________________________________________
Accounts & Technical Services || Tues-Sat 7AM-4PM Pacific Time
Truth poorly defended loses not its truthfulness

Contact a live Support Rep directly - http://us.blizzard.com/en-us/company/about/contact.html
Please feel free to rate my services: https://www.surveymk.com/s/DXF96P2