After parsing
| From: | stacygt at comcast dot net | Date: | Tue, 09 Nov 2010 03:40:50 +0000 |
| Subject: | After parsing | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-309391@lists.php.net to get a copy of this message | ||
The parse worked great, got all the information I needed. Being so new to php, I am not sure how to
get this information to display in an html table so that I can style it...any suggestions would be
greatly appreciated. It displays in my browser but I have not been able to figure out how to get it
into a table on a page. (This is not the whole script, just wanted to show the portion to try to
give a picture...of what I was working with... SimpleXMLElement.)
foreach ($guildxml->guildInfo->guild->members->children() as $char) {
if ( $char['level'] < 20 ) continue;
$toonrace = return_race($char['raceId'], $char['genderId']); // Maps
Race and Sex
$toonclass = return_class($char['classId']); // Maps class name
$toonrank = return_rank($char['rank']); // Maps guild rank name
$cch = curl_init();
curl_setopt ($cch, CURLOPT_URL, $charurl . $char['url']);
curl_setopt ($cch, CURLOPT_RETURNTRANSFER, true);
curl_setopt ($cch, CURLOPT_USERAGENT, $browser_user_agent);
$charxml = curl_exec($cch);
$detailxml = new SimpleXMLElement($charxml);
echo '<b>Name:</b> <a href="' .$charurl . $char['url']
.'" target="_blank">' . $char['name'] . '</a>
'; //Includes an armory external link
echo '<b>Class:</b> ' . $toonclass . ' ';
echo '<b>Race:</b>' . $toonrace . ' ';
echo '<b>Rank:</b> ' . $toonrank .' ';
echo '<b>Level:</b> ' . $char['level'] . ' '; //
Displays char level
echo '<b>Professions: </b> ';
foreach ($detailxml->characterInfo->characterTab->professions->children() as
$profession) {
if ($profession['name']=NULL) continue;
// Displays all of the professions and skill levels and maximums
echo $profession['name'] . ' (' . $profession['value'] .
'/' . $profession['max'] .') ';
}
echo '<b>Specs: </b> ';
foreach ($detailxml->characterInfo->characterTab->talentSpecs->children() as $spec)
{
// Displays all of the specs in use and their builds and names. It is easily possible to show
which one is active as well.
echo $spec['prim'] . '(' . $spec['treeOne'] . '/' .
$spec['treeTwo'] . '/' . $spec['treeThree'] . ') ';
}
echo '<br>';
} ggestions? The manual is a bit overwhelming, and I have searched for a solution, am really lost.