Advertisement
Guest User

Untitled

a guest
Sep 4th, 2015
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. <?php
  2. include('simple_html_dom.php');
  3.  
  4. function scrapeHighscore($world) {
  5. $html = str_get_html('https://secure.tibia.com/community/?subtopic=highscores&world=' . $world);
  6. $tables = $html->find('table');
  7. foreach($tables as $table) {
  8. $names = $table->find('a');
  9. foreach($names as $name) {
  10. return $name . ' - ';
  11. }
  12.  
  13. $levels = $table->find('td[@width="15%"]');
  14. foreach ($levels as $level) {
  15. return $level . ' - ';
  16. }
  17.  
  18. $experiences = $table->find('td[@width="20%"]');
  19. foreach ($experiences as $experience) {
  20. return $experience . '<br>';
  21. }
  22. }
  23. }
  24.  
  25. echo scrapeHighscore('Antica');
  26.  
  27. ?>
  28.  
  29. Meendel 536 2538560931
  30. Drendaric 514 2237710308
  31. Magicalse 509 2180132453
  32. ...
  33. King Migoon 446 1460356304
  34.  
  35. function scrapeHighscore($world) {
  36. $output = '';
  37. $html = str_get_html('https://secure.tibia.com/community /?subtopic=highscores&world=' . $world);
  38. $tables = $html->find('table');
  39. foreach($tables as $table) {
  40.  
  41. $names = $table->find('a');
  42. foreach($names as $name) {
  43. $output.= $name . ' - ';
  44. }
  45.  
  46. $levels = $table->find('td[@width="15%"]');
  47. foreach ($levels as $level) {
  48. $output.= $level . ' - ';
  49. }
  50.  
  51. $experiences = $table->find('td[@width="20%"]');
  52. foreach ($experiences as $experience) {
  53. $output.= $experience . '<br>;
  54. }
  55. }
  56. return $output;
  57. }
  58. echo scrapeHighscore('Antica');
  59.  
  60. $html = str_get_html('https://secure.tibia.com/community /?subtopic=highscores&world=' . $world);
  61. echo $html;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement