1

http://www.tibia.com/community/?subtopic=characters&name=Nikla

In this link, at the bottom of the character profile, there is a list of deaths. How can I "collect" the date information? I'm not worried about the rest, just the date of each death.

I will be using a PHP file to complete this.

I've seen this post: How do I make a simple crawler in PHP? I just don't know where to begin.

Can anyone point me to the right direction?

Community
  • 1
  • 1
Evan
  • 2,405
  • 3
  • 20
  • 24

1 Answers1

2

You can use a DOM parse like Simple HTML DOM Parser. Download the archive from SourceForge install it, include the file in your script and then use it.

The website has an ugly table layout but you can do something like this:

Code:

<?php

include('simple_html_dom.php');
$html = file_get_html('http://www.tibia.com/community/?subtopic=characters&name=Nikla');
$count = 0; //counter variable
foreach($html->find('//*[@id="characters"]/div[5]/div/div/table[3]/tbody/tr['.
  $i.']') as $table) { //traverse through the table and get <td> content
   echo $table."<br/>";
   $count++;
}

?>

Output:

Character Deaths
Jul 11 2013, 08:08:11 CEST  Killed at Level 36 by Cintyus and Seque Ladinho.
Jul 11 2013, 07:32:31 CEST  Killed at Level 36 by Drunk Noongah and Rea Per.
Jul 09 2013, 22:05:42 CEST  Killed at Level 35 by Evil Kris and Tensser.
Jun 29 2013, 20:25:27 CEST  Killed at Level 27 by Knight Abron.
Jun 27 2013, 07:31:33 CEST  Killed at Level 23 by Mysterioz Pandoria Knight.
Jun 14 2013, 23:52:14 CEST  Died at Level 16 by a rotworm.

That's just an example to get you started. You can modify it and get what you want.

Hope this helps!

Amal Murali
  • 75,622
  • 18
  • 128
  • 150