All pastes #938979 Raw Edit

James

public text v1 · immutable
·published 2008-03-11 23:34 UTC
rendered paste body
function halo3($GET) {
  if (!$GET) $OutPut = "Syntax Error: [!@]Halo3 <GamerTag>";
  $data = file_get_contents("http://www.bungie.net/Stats/Halo3/Default.aspx?player=" . str_replace(" ","+",$_GET["gamertag"]));
  if (!$OutPut) $OutPut = c1($GET)." is not ranked in Halo 3, or does not have a Live Account";
  return logo(Halo3).' '.htmlspecialchars_decode($OutPut);
}
function urban($GET) {
  if (!$GET) $OutPut = "Syntax Error: [!@]Urban <Word>";
  $data = file_get_contents("http://www.urbandictionary.com/define.php?term=".urlencode($GET));
  if (preg_match_all('/<p>(.*)<\/p>/i',$data,$matches)) {
    $OutPut .= "{$GET}: ".c1(strip_tags(str_replace(array("<b>","</b>"),"\002",$matches[1][0])));
  }
  if (preg_match_all("/<p style=\"font-style\: italic\">(.*)<\/p>/i",$data,$matches)) {
    $OutPut .= " | Example: ".c1(strip_tags(str_replace(array("<b>","</b>"),"\002",$matches[1][0])));
  }
  if (!$OutPut) $OutPut = "No matches found";
  return logo(Urban).' '.htmlspecialchars_decode($OutPut);
}
function define_($GET) {
  if (!$GET) $OutPut = "Syntax Error: [!@]Urban <Word>";
  $data = file_get_contents("http://dictionary.cambridge.org/define.asp?key=".urlencode($GET)."*1+0&dict=A");
  if (preg_match_all('/<span class=\'def-definition\'>(.*?)<\/span>/i',$data,$matches)) {
    $OutPut .= "{$GET}: ".c1(strip_tags(str_replace(array("<b>","</b>"),"\002",$matches[1][0])));
  }
  if (!$OutPut) $OutPut = "No matches found";
  return logo(Define).' '.htmlspecialchars_decode($OutPut);
}
function southpark($GET) {
  if (!$GET) $OutPut = "Syntax Error: [!@]SouthPark <Video Name>";
  $data = file_get_contents("http://southpark.comedycentral.com/video_search.jhtml?searchterm=".urlencode($GET)."&button.x=0&button.y=0&button=Search");
  if (preg_match_all("/<div class=\"results-title\">.*\n.*<a href=\".*\">(.*)<\/a>/i",$data,$matches)) {
    $OutPut .= "Title: ".c1(strip_tags(str_replace(array("<b>","</b>"),"\002",$matches[1][0])))." | ";
  }
  if (preg_match_all('/<b>Aired: <\/b>(.*)<\/div>/i',$data,$matches)) {
    $OutPut .= "Aired: ".c1(strip_tags(str_replace(array("<b>","</b>"),"\002",$matches[1][0])))." | ";
  }
  if (preg_match_all('/<div class="results-summary">(.*)<\/div>/i',$data,$matches)) {
    $OutPut .= "Details: ".c1(strip_tags(str_replace(array("<b>","</b>"),"\002",$matches[1][0])));
  }
  if (!$OutPut) $OutPut = "No videos found";
  return logo(SouthPark).' '.htmlspecialchars_decode($OutPut);
}
function youtube($GET) {
  if (!$GET) $OutPut = "Syntax Error: [!@]SouthPark <Video Name>";
  $data = file_get_contents("http://youtube.com/results?search_query=".urlencode($GET)."&search_type=&search=Search");
  if (preg_match_all("/<a href=\"\/watch\?v\=(.*)\" title=\".*\">(.*)<\/a>/i",$data,$matches)) {
    $OutPut .= "Title: ".c1(strip_tags(str_replace(array("<b>","</b>"),"\002",$matches[2][0])))." | ";
    $OutPut .= "URL: ".c1('www.YouTube.com/watch?v=').c1(strip_tags(str_replace(array("<b>","</b>"),"\002",$matches[1][0])));
  }
  if (!$OutPut) $OutPut = "No videos found";
  return logo(YouTube).' '.htmlspecialchars_decode($OutPut);
}
function players() {
  $data = file_get_contents("http://www.runescape.com/title.ws");
  if (preg_match_all("/There are currently (.*) people playing!/i",$data,$matches)) {
    return logo(Players)." There are currently ".c1(number_format($matches[1][0]))." players online";
  }
}
function rsnews() {
  $data = file_get_contents("http://www.runescape.com/title.ws");
  if (preg_match_all("/<dt><span class=\"newsdate\">(.*)<\\/span>(.*)<\\/dt>/i",$data,$matches)) {
    return logo(RsNews)." Title: ".c1($matches[2][0])." | Date: ".c1($matches[1][0]);
  }
}