View Single Post
  #8  
Old 02-04-2003, 12:38 AM
digitalJE5U5 digitalJE5U5 is offline
 
Join Date: Sep 2002
Posts: 56
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, below is some code that takes the "rating" off that page.
PHP Code:
function getmicrotime()
{
  list($usec, $sec) = explode(" ",microtime()); 
  return ((float)$usec + (float)$sec); 

$starttime = getmicrotime();

$t = time();        
$url = "http://aom.stats.zone.msn.com/AOM_RC0/query/query.aspx";
$q = "<?xml%20version=\"1.0\"?><clr><cmd%20v=\"query\"/>";
$q .= "<co%20g=\"AOM_RC0\"%20s=\"100\"%20z=\"1.0.3\"%20t=\"".$t."\"%20U=\"6\"/>";
$q .= "<qer%20id=\"0\"%20np=\"0\"%20nn=\"20\"%20si=\"0\"%20et=\"ZS_Human\"%20md=\"ZS_Supremacy\"%20rn=\"ZS_TopPlayers\"%20tp=\"ZS_AllTime\"/>";
$q .= "</clr>";
        
$top20 = array();
$rdf = parse_url($url);
$fp = fsockopen($rdf['host'], 80, $errno, $errstr, 30);
if (!$fp) {
    echo "Problem loading ESO Stats Data";
    return;
    }
if ($fp) {
    fputs($fp, "GET " . $rdf['path'] . "?" . $q . " HTTP/1.0\r\n");
    fputs($fp, "HOST: " . $rdf['host'] . "\r\n\r\n");
    $string    = "";
    $pagetext = "";
    while(!feof($fp)) {
        $pagetext .= chop(fgetc($fp));
    }
    fputs($fp,"Connection: close\r\n\r\n");
    fclose($fp);
    $string = chop($pagetext);
    $items = explode("\"",$string);
    $lines = count($items);
    $offset = 1;
    for ($i=23;$i<$lines;$i+=12) {
        $top20[$offset]["name"] = $items[$i];
        $top20[$offset]["rank"] = $items[$i+2];
        $top20[$offset]["rating"] = intval($items[$i+6]);
        $offset++;
    }
        ## Hint:  Changing the "6" below to a larger number will increase the number of players displayed.  Max. = 20 ##
    for ($j=1;$j<2;$j++) {
        $rating .= $top20[$j]["rating"];
    }
}
Maybe that better illustrates what Im trying to do. Now, I did NOT by any means write that code. I found it, and modified it to do what I need.

2 things:
1- What extranious things can I remove from that code, so its more streamlined? Can I 86 the microtime stuff?
2- Where in global.php should I put the finished code, so that I can pull $rating and have it show up wherever I put that variable?

Thanks alot for the help guys.
/DJ
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01177 seconds
  • Memory Usage 1,780KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete