Advertisement
hejmus

Untitled

Aug 19th, 2012
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.94 KB | None | 0 0
  1. $elapsed=file_exists("cache/dps.cache")?filemtime("cache/dps.cache"):0;
  2.  
  3. if (time() - $elapsed > 60*5)
  4. {
  5.     $fp=fopen("http://www.worldoflogs.com/guilds/67175/rankings/players/","r");
  6.     $html=stream_get_contents($fp);
  7.     fclose($fp);
  8.     $html=str_replace("<a href='/","<a href='http://www.worldoflogs.com/",$html);
  9.     $dps_start=strpos($html,"<table class='playerRankMixed'>");
  10.     $dps_end=strpos($html,"</table>",$dps_start);
  11.     $heal_start=strpos($html,"<table class='playerRankMixed'>",$dps_end);
  12.     $heal_end=strpos($html,"</table>",$heal_start);
  13.  
  14.     $dps=substr($html,$dps_start,$dps_end-$dps_start)."</table>";
  15.     file_put_contents("cache/dps.cache",$dps);
  16.     echo $dps;
  17.     $heal=substr($html,$heal_start,$heal_end-$heal_start)."</table>";
  18.     file_put_contents("cache/heal.cache",$heal);
  19.     echo $heal;
  20. }
  21. else
  22. {
  23.     echo file_get_contents("cache/dps.cache");
  24.     echo file_get_contents("cache/heal.cache");
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement