Hello.
Is there SQL file for battlefield 3? (BF3.sql) ? like Battlefield Bad Company 2 (BFBC2.sql).
Thanks.
Code: Select all
<?php
$data=array('players'=>array(),'opt'=>array());
// List of players
$data['players'][]='zh1nt0';
$data['players'][]='DocDurchschnitt';
// List of options
$data['opt']['all']=true;
// Platform can be pc, 360, ps3
$platform='pc';
// Convert lists to JSON
$postdata=array();
$postdata['players']=json_encode($data['players']);
$postdata['opt']=json_encode($data['opt']);
// Run POST Request via CURL
$c=curl_init('http://api.bf3stats.com/'.$platform.'/playerlist/');
curl_setopt($c,CURLOPT_HEADER,false);
curl_setopt($c,CURLOPT_POST,true);
curl_setopt($c,CURLOPT_USERAGENT,'BF3StatsAPI/0.1');
curl_setopt($c,CURLOPT_HTTPHEADER,array('Expect:'));
curl_setopt($c,CURLOPT_RETURNTRANSFER,true);
curl_setopt($c,CURLOPT_POSTFIELDS,$postdata);
$data=curl_exec($c);
$statuscode=curl_getinfo($c,CURLINFO_HTTP_CODE);
curl_close($c);
if($statuscode==200) {
// Decode JSON Data
$data=json_decode($data,true);
// Print data for debugging
echo '<pre>';
print_r($data);
// print list of players with rank and score
foreach($data['list'] as $d) {
$stats=$d['stats'];
echo $d['name']." | ".$stats['rank']['name']." (".$stats['rank']['nr'].") Score: ".$stats['scores']['score']."\n";
}
echo '</pre>';
// ... now you use $data to do whatever
} else {
echo "BF3 Stats API error status: ".$statuscode;
}
?>
Users browsing this forum: No registered users and 22 guests