Ejemplo n.º 1
0
 private function getStats()
 {
     $mb = new MultiFetch();
     $url = Runescape::getScoresUrl($this->name);
     $skills = Runescape::getSkills();
     $mb->addResource($url);
     $mb->execute();
     $res = explode("\n", $mb->getResult($url));
     for ($i = 0, $c = count($skills); $i < $c; $i++) {
         $temp = [];
         list($temp['Rank'], $temp['Level'], $temp['Experience']) = explode(',', $res[$i], 3);
         $this->stats[$skills[$i]] = $temp;
     }
     $this->statsLoaded = true;
 }
Ejemplo n.º 2
0
        }
        $processing = 0;
        do {
            curl_multi_exec($master, $processing);
        } while ($processing > 0);
        foreach ($this->handles as $url => $h) {
            $code = curl_getinfo($h, CURLINFO_HTTP_CODE);
            if ($code == 200) {
                $this->results[$url] = curl_multi_getcontent($h);
            } else {
                $this->results[$url] = null;
            }
        }
    }
    public function getResult($url)
    {
        return $this->results[$url];
    }
}
return;
function getUrl($un)
{
    return 'http://hiscore.runescape.com/index_lite.ws?player=' . urlencode($un);
}
$mf = new MultiFetch();
$mf->addResource(getUrl('the ZUL'));
$mf->addResource(getUrl('zezima'));
$mf->addResource(getUrl('trioted'));
$mf->addResource(getUrl('kaneezdizzle'));
$mf->addResource(getUrl('skarpen666'));
$mf->execute();