Guest User

Untitled

a guest
Sep 28th, 2010
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.25 KB | None | 0 0
  1. <?php
  2. $html = file_get_contents("http://www.bungie.net/stats/reach/globalchallenges.aspx");
  3. #file_put_contents("/tmp/globalchallenges.aspx", $html);
  4. #$html = file_get_contents("/tmp/globalchallenges.aspx");
  5.  
  6. rss_header();
  7. $pos = strpos($html, "<h5>");
  8. while ($pos !== false) {
  9.     $title = fuckawesomefind($html, "<h5>", "</h5>", $pos);
  10.     $description = fuckawesomefind($html, 'escription">', "</p>", $pos);
  11.     $credits = fuckawesomefind($html, "</span> ", "</p>", $pos);
  12.     rss_item($title, "$description - $credits");
  13.     $pos = @strpos($html, "<h5>", $pos);
  14. }
  15. rss_footer();
  16.  
  17. function fuckawesomefind($text, $skey, $ekey, &$location = 0) {
  18.     $start_pos = strpos($text, $skey, $location) + strlen($skey);
  19.     $end_pos = strpos($text, $ekey, $start_pos);
  20.     $location = $end_pos;
  21.     return substr($text, $start_pos, $end_pos-$start_pos);
  22. }
  23.  
  24. function rss_header() {
  25.     print '<?xml version="1.0"?>' . "\n";
  26.     print '<rss version="2.0">' . "\n";
  27.     print '<channel>';
  28. }
  29.  
  30. function rss_item($title, $description) {
  31.     print "<item\n";
  32.     print "<title>$title</title>\n";
  33.     print "<description>$description\n</description>\n";
  34.     print "</item>\n";
  35. }
  36.  
  37. function rss_footer() {
  38.     print "</channel>\n";
  39.     print "</rss>\n";
  40. }
Advertisement
Add Comment
Please, Sign In to add comment