Jump to content


Photo

Parse grab dynamic data


  • Please log in to reply
1 reply to this topic

#1 Agent_Stone

Agent_Stone
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 06 March 2006 - 06:02 PM

I need some help making a script to grab a webpage and only select a certain area of the site.

Address I want to parse [a href=\"http://aaotracker.4players.de/clanprofile.php?clanid=24983\" target=\"_blank\"]http://aaotracker.4players.de/clanprofile.php?clanid=24983[/a]

Here is am image of what I want to grab and post.

[a href=\"http://img64.imageshack.us/my.php?image=parsestats1fc.jpg\" target=\"_blank\"][img src=\"http://img64.imageshack.us/img64/9519/parsestats1fc.th.jpg\" border=\"0\" alt=\"IPB Image\" /][/a]

Plz help I ont know ho to parse it but can create a apge that shows the exact page.

#2 craygo

craygo
  • Staff Alumni
  • Advanced Member
  • 1,973 posts
  • LocationRhode Island

Posted 06 March 2006 - 06:17 PM

Where is the clanid coming from?? have you made a page that lists the clans. if not then here is something that will list the clans

<?
$sql = "SELECT clanid, clanname FROM tablename";
  $result = mysql_query($sql) or die (mysql_error());
    while($rows = mysql_fetch_array($result)){
print 'Stats for clan <a href="http://aaotracker.4players.de/clanprofile.php?clanid='.$rows['clanid'].'">'.$rows['clanname'].'</a><br>';
}
?>

and the clanprofile.php page will be the template
<?
$clanid = $_GET['clanid'];
$sql = "SELECT clanid, clanname FROM tablename WHERE clanid = "$clanid"";
  $result = mysql_query($sql) or die (mysql_error());
    while($rows = mysql_fetch_array($result)){
print '<tr>
<td>Clan Name</td>
<td>'.$rows['clanname'].'</td>
</tr>';
}
?>
Just remember this is a loop so anything you do not want to print in the loop will have to go before the "while" statement. Like field headers and such.

Ray




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users