Hi.
I'm making a memberlist for my legion at the online game "Aion".
I wanted to find the stats for each member, and yes it worked perfectly, but it took some time for the page to load up..
Take a look at this code:
<?php
//The $userdata['character'] is from mysql but let's just set it manually..
$userdata['character'] = "Norge";
$text = file_get_contents('http://uk.aiononline.com/characters/Perento/'. $userdata['character']);
$nr = 9;
do
{
$searchfor = '<span class="name"><span>Lv.</span> <em>'. $nr .'</em>';
$pos = strpos($text, $searchfor);
if ($pos == true) {
$stat = $nr;
$nr = 51;
}
else
{
$nr++;
}
}
while ($nr < 51);
if ($pos != true){
$stat = "<b>Below 10</b>";
}
// Okay, on the memberlist it will now say "19" under level on the user "Norge". Let's just echo it here..
echo "My level is now: <b>". $stat."</b>";
?>
This code goes to http://uk.aiononline.com/characters/Perento/Norge, reads the sourcecode of the page and is looking for "<span class="name"><span>Lv.</span> <em>" with a number behind, and it stopped when it reached: <span class="name"><span>Lv.</span> <em>19 because "Norge" is level 19. then it made the variable $stat with 19.
Is there any better way to do this so the page would load up faster?
Please help!