Winter!: Prepare for holiday gaming!

Forums top   gamerDNA.com Forums > gamerDNA.com > Helix Developers/API (Beta)

Thread Tools
Old 05-21-2009, 10:46 PM
brianchilders's Avatar
brianchilders brianchilders is offline
Join Date: Apr 2009
Location: Kenosha, WI
Posts: 1
brianchilders is community member of note
Post Example PHP Code
For those of you who are looking to get started with the APIs but may not know PHP, I am posting an example that will help you get started.

This will retrieve a list of gamerDNA achievements and display them.

The code can be modified to suit your tastes.

PHP Code:
// URL of web service
$target_url "http://helix.gamerdna.com/get_member_profile.php?member=<member name>&apikey=<api key from profile>";
// User Agent
$userAgent 'Googlebot/2.1 (http://www.googlebot.com/bot.html)';
// Set up cURL parameters
$ch curl_init();
// Fetch the XML
$xml curl_exec($ch);
// Nothing in $xml - display error.
if (!$xml)
"<br />cURL error number:" .curl_errno($ch);
"<br />cURL error:" curl_error($ch);
// Load the resulting XML into a DOMDocument
$dom = new DOMDocument();
$xpath = new DOMXPath($dom);
// Retrieve the achievement information
$achievements $xpath->evaluate("/api/profile/achievements/achievement/name");
// Length of achievements found
echo $achievements->length." achievements found..";
// Name of achievements
for ($i 0$i $achievements->length$i++)
$achievement $achievements->item($i);
"<br />Name of achievement: ".$achievement->nodeValue;
Would love to hear from other programmers as far as tips / tricks / techniques in using the APIs.

Thanks and have a great day!

Reply With Quote
Old 05-26-2009, 08:18 AM
RDaneel's Avatar
RDaneel RDaneel is offline
Join Date: May 2009
Location: Not in Kansas
Posts: 10
RDaneel is a jewel in the community
I'd say it's Greek to me, but it's actually more like COBOL to me.
Reply With Quote
Post Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off