PHP Kod:
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://www.gametracker.com/server_info/93.123.18.5:27017/top_players/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Cache-Control: no-cache",
"Host: www.gametracker.com",
"accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"accept-language: en-US,en;q=0.5",
"upgrade-insecure-requests: 1",
"user-agent: Mozilla/5.0"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
//echo $response;
}
PHP Kod:
$str = preg_replace (
'/[\n\s]/' ,
'' ,
$response);
PHP Kod:
$re = '/<td>[^"]*"\/player\/(.*?)\/[^<]*<\/a><\/td><td> <\/td><td>(.*?)<\/td><td>(.*?)<\/td><td>(.*?)<\/td>/m';
PHP Kod:
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
PHP Kod:
echo 'Name Score Time Score/Min <br>';
for($i=0;$i<10;$i++) {
for($w=1;$w<5;$w++) {
echo urldecode($matches[$i][$w]). ' ';
}
echo '<br>';
}
BÜTÜN KOD:
PHP Kod:
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://www.gametracker.com/server_info/93.123.18.5:27017/top_players/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Cache-Control: no-cache",
"Host: www.gametracker.com",
"accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"accept-language: en-US,en;q=0.5",
"upgrade-insecure-requests: 1",
"user-agent: Mozilla/5.0"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
//echo $response;
}
$str = preg_replace (
'/[\n\s]/' ,
'' ,
$response);
$re = '/<td>[^"]*"\/player\/(.*?)\/[^<]*<\/a><\/td><td> <\/td><td>(.*?)<\/td><td>(.*?)<\/td><td>(.*?)<\/td>/m';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
echo 'Name Score Time Score/Min <br>';
for($i=0;$i<10;$i++) {
for($w=1;$w<5;$w++) {
echo urldecode($matches[$i][$w]). ' ';
}
echo '<br>';
}
?>