All pastes #986903 Raw Edit

Untitled

public text v1 · immutable
·published 2008-04-16 01:34 UTC
rendered paste body
<start>

<?

$dat = file_get_contents('http://game.endless-online.com/playerlist.html');
  $med = getStrsBetween($dat,'		<tr>
		<td width="155"><font face="Arial" size="2" color ="#111111">','</font>
		</td><td width="155"><font face="Arial" size="2" color ="#111111">');


  foreach($med as $key => $val){
    if($f){
      $f = false;
      $ekey = $key;
    }
  }

  $medr = getStrsBetween($dat,'		<tr>
		<td width="155"><font face="Arial" size="2" color ="#111111">','</font>
		</td><td width="155"><font face="Arial" size="2" color ="#111111">');
  foreach($medr as $key => $val){
	$calfl = array("		", "
");
	print "<eomain>".str_replace($calfl, "", $key)."</eomain>\n";
  }







function getStrsBetween($s,$s1,$s2=false,$offset=0) {
  if( $s2 === false ) { $s2 = $s1; }
    $result = array();
    $L1 = strlen($s1);
    $L2 = strlen($s2);
    if( $L1==0 || $L2==0 ) {
      return false;
    }
    do {
      $pos1 = strpos($s,$s1,$offset);
      if( $pos1 !== false ) {
        $pos1 += $L1;
        $pos2 = strpos($s,$s2,$pos1);
        if( $pos2 !== false ) {
          $key_len = $pos2 - $pos1;
          $this_key = substr($s,$pos1,$key_len);
          if( !array_key_exists($this_key,$result) ) {
            $result[$this_key] = array();
          }
          $result[$this_key][] = $pos1;
          $offset = $pos2 + $L2;
        } else {
          $pos1 = false;
        }
        }
  } while($pos1 !== false );
  return $result;
}
?>

</start>