Jump to content


Photo

How to get info from other pages.


  • Please log in to reply
3 replies to this topic

#1 Dobakat

Dobakat
  • Members
  • PipPipPip
  • Advanced Member
  • 54 posts

Posted 18 April 2006 - 08:52 PM

Well I have my site of my Guild in Tibia, a MMRP. Well all I been able to get has been the list of my members, but as you can see in [a href=\"http://www.istariguild.com/members.php\" target=\"_blank\"]http://www.istariguild.com/members.php[/a] I am still missing the level and Vacation. (the other column I don't really care.) I know there is a way to have php check on every members info and grab their level and vocation without having the database username and password..Each page containing the info of a member looks like this
[a href=\"http://www.tibia.com/community/?subtopic=character&name=Dobakat\" target=\"_blank\"]http://www.tibia.com/community/?subtopic=c...er&name=Dobakat[/a]
from this page I want to get hte level and vocation of this character, which is in this case Dobakat, me:P.... and check on every member's page to get the same information..I want to do this so it updates automatically as soon as the character levels, or changes vocation.

well I hope there is a way, and thanks..

#2 Caesar

Caesar
  • Members
  • PipPipPip
  • Advanced Member
  • 1,025 posts

Posted 18 April 2006 - 09:25 PM

What does your code look like so far?

If I got this right (Because there seems to be a slight language barrier here) you want to pull the information from a website's stats page without having access to that particular database, and then display it on another site? Definitely possible...not that easy for a novice PHP programmer. Again, maybe we can walk you through this if you show us some of the code you are working with.
PHP Ninja

#3 Dobakat

Dobakat
  • Members
  • PipPipPip
  • Advanced Member
  • 54 posts

Posted 18 April 2006 - 09:36 PM

well the online/offline column works thanks to a person that gave me some of the code.. thats what i have..



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Istari Guild</title>
<link rel="STYLESHEET" href="style.css" type="text/css">
<style type="text/css">
<!--
.style1 {
font-size: 28px;
color: FFBA27;
}
.style3 {color: #666666}
-->
</style></head>
<body bgcolor="FFFFFF">
<div align="center">
<table width="750" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3" width="750">
<table width="750" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="750" colspan="3"><span class="style1">Istari Guild </span></td>
</tr>
<tr>
<td width="330">&quot;Together we stand, together we die!&quot; </td>
<td width="400" align="right">
<table width="400" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="right" height="20">
<FORM ACTION="http://www.tibia.com...opic=character" METHOD=post>
<span class="style3">Search for Character</span>
<INPUT NAME="name" VALUE=""SIZE=20 MAXLENGTH=29>
<input name="Submit" type="submit" value="Search">
</FORM>

</tr>
</table>
</td>
<td width="20"></td>
</tr>
</table>
</td>
</tr>
<tr></tr>
<tr>
<td colspan="3" height="1" bgcolor="CCCCCC"></td>
</tr>
<tr>
<td colspan="3" height="10" bgcolor="FFFFFF"></td>
</tr>
<tr>
<td width="170" bgcolor="FFFFFF" valign="top">
<span style="font-size:6px"><br></span>
<div align="center">
<table width="140" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><?php
include($_SERVER['DOCUMENT_ROOT'].'/menu.php');
?></td>
</tr>
</table>
<br><span style="font-size:6px"><br></span>
<table width="140" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3" height="1" bgcolor="AAAAAA"></td>
</tr>
<tr>
<td width="1" bgcolor="AAAAAA" rowspan="5"></td>
<td width="138" height="26" bgcolor="F9F9F9" style="color:FFBA27;font-size:14px">
<div align="center">&nbsp;Announcements
</div></td>
<td width="1" bgcolor="AAAAAA" rowspan="5"></td>
</tr>
<tr>
<td height="1" bgcolor="AAAAAA"></td>
</tr>
<tr>
<td bgcolor="FFFFFF">
<table width="138" border="0" cellpadding="7" cellspacing="0">
<tr>
<td style="color:#666666"><div align="left">
<?php
include($_SERVER['DOCUMENT_ROOT'].'/announcements.php');
?>
</div></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="1" bgcolor="AAAAAA"></td>
</tr>
</table>
<span style="font-size:6px"><br></span>
</div>
</td>
<td width="1" bgcolor="CCCCCC"></td>
<td width="579" valign="top">
<span style="font-size:6px"><br></span>
<div align="center">
<table width="549" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="4" height="1" bgcolor="AAAAAA"></td>
<td width="5" height="1" bgcolor="FFFFFF"></td>
</tr>
<tr>
<td width="1" bgcolor="AAAAAA"></td>
<td rowspan="2" colspan="2" width="542" height="27" bgcolor="F9F9F9" style="color:FFBA27;font-size:15px">&nbsp;&nbsp;Member List </td>
<td width="1" bgcolor="AAAAAA"></td>
<td width="5" height="4" bgcolor="FFFFFF"></td>
</tr>
<tr>
<td width="1" bgcolor="AAAAAA"></td>
<td width="1" bgcolor="AAAAAA"></td>
<td width="5" bgcolor="F0F0F0" height="23"></td>
</tr>
<tr>
<td width="1" bgcolor="AAAAAA"></td>
<td colspan="2" height="1" bgcolor="AAAAAA"></td>
<td width="1" bgcolor="AAAAAA"></td>
<td width="5" bgcolor="F0F0F0"></td>
</tr>
<tr>
<td width="1" height="206" bgcolor="AAAAAA"></td>
<td colspan="2" bgcolor="FFFFFF">
<table width="542" border="0" cellpadding="17" cellspacing="0">
<tr>
<td style="color:#666666;line-height:1.6em">
<div align="center">
<?php
$world = "Trimera";
$guildname = "Istari";


$path = "http://www.tibia.com/statistics/?subtopic=whoisonline&world=".urlencode($world);
if ($contents = file_get_contents($path)) {



$members = file_get_contents('http://www.tibia.com/community/?subtopic=guilds&page=view&GuildName='.urlencode($guildname)); // get the members file
$members = split("<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>\s|\S*</TABLE>",$members); // get the big parts
$members = strip_tags($members[8],'<tr>'); //take the members element
$members = preg_replace('!<TR BGCOLOR=#w{6,6}|</TR>!','',$members);
$members = str_replace(' ',' ',$members); //Replace HTML entity with normal space.
$members = explode('>',$members);

unset($members[0],$members[1],$members[2]);

for($count=3;$count<count($members)+3;$count++){
$newmember = explode("\n",$members[$count]); //Split up user info.
if (count($newmember) == 3) {
$name = $newmember[2];
} else {
$name = $newmember[1];
}
$name = explode(" (",$name);
$characterSearch = str_replace(' ',' ',$name[0]); //Recovert space to HTML entity for searching.

$characterSearch = ">".$characterSearch."<";

$inOnline = count($onlineList);
$inOffline = count($offlineList);

if (strpos($contents,$characterSearch)) {
$onlineList[$inOnline] = $name[0];
} else {
$offlineList[$inOffline] = $name[0];
}
}
@reset(sort($onlineList));
@reset(sort($offlineList));
?>


<?
echo "".count($members)." Members in the Guild.";
echo "<table border=1 cellpadding=1>";

echo "<tr>";
echo "<td>";
echo "Name";
echo "<td>";
echo "Vocation";
echo "</td>";
echo "<td>";
echo "Level";
echo "</td>";
echo "<td>";
echo "Status";
echo "</td>";
echo "</tr>";
for ($count=0;$count<count($onlineList);$count++) {
$characterSearch = str_replace(' ',' ',"".$onlineList[$count].""); //Recovert space to HTML entity for searching.

$characterSearch = ">".$characterSearch."<";
$level=$level;

echo "<ul id=\"onlineList\">";
echo "<tr>";
echo "<td>";
echo "<a href=\"http://www.tibia.com/community/?subtopic=character&name=".urlencode($onlineList[$count])."\">".$onlineList[$count]."</a>";
echo "<td>";
echo " ";
echo "</td>";
echo "<td>";
echo "$level";
echo "</td>";
echo "<td>";
echo "Online";
echo "</td>";
echo "</tr>";
}

echo" ";
echo "</ul><ul id=\"offlineList\">";

for ($count=0;$count<count($offlineList);$count++) {
echo "<tr>";
echo "<td>";
echo "<a href=\"http://www.tibia.com/community/?subtopic=character&name=".urlencode($offlineList[$count])."\">".$offlineList[$count]."</a>";
echo "<td>";
echo " ";
echo "</td>";
echo "<td>";
echo " ";
echo "</td>";
echo "<td>";
echo "Offline";
echo "</td>";
echo "</tr>";
}
echo "</ul>";
} else {

echo "<p>Opening ".$path." failed.</p>";
}
echo "</table>";

?>
</div></td></tr>
</table>
</td>
<td width="1" bgcolor="AAAAAA"></td>
<td width="5" bgcolor="F0F0F0"></td>
</tr>
<tr>
<td width="1" bgcolor="AAAAAA"></td>
<td colspan="2" height="1" bgcolor="AAAAAA"></td>
<td width="1" bgcolor="AAAAAA"></td>
<td width="5" bgcolor="F0F0F0"></td>
</tr>
<tr>
<td width="1" height="5" bgcolor="FFFFFF"></td>
<td width="4" height="5" bgcolor="FFFFFF"></td>
<td width="538" height="5" bgcolor="F0F0F0"></td>
<td width="1" height="5" bgcolor="F0F0F0"></td>
<td width="5" height="5" bgcolor="F0F0F0"></td>
</tr>
</table>
<span style="font-size:6px"><br>
</span>
</div>
</td>
</tr>
<tr>
<td colspan="3" height="10" bgcolor="FFFFFF"></td>
</tr>
<tr>
<td colspan="3" height="1" bgcolor="CCCCCC"></td>
</tr>
<tr>
<td colspan="3" height="5" bgcolor="FFFFFF"></td>
</tr>
<tr>
<td colspan="3" bgcolor="FFFFFF" align="right"><p>Copyright © 2006, <strong>Dobakat</strong></a>. All Rights Reserved.<br>
The only official site of Tibia is <strong>www.tibia.com</strong>.<br>
Tibia is a copyright of CipSoft GmbH, 2006.</p>
</td>
</tr>
</table>
</div>
</body>
</html>

the main page is [a href=\"http://www.istariguild.com/index.php\" target=\"_blank\"]http://www.istariguild.com/index.php[/a]

#4 Dobakat

Dobakat
  • Members
  • PipPipPip
  • Advanced Member
  • 54 posts

Posted 19 April 2006 - 02:28 PM

I knw my question is quite hard/long, but can someone help me?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users