Your phpBB Type: Standard phpBB3
MODs installed: Yes
Your knowledge: Beginner
What have you done before the problem was there?
What have you already tryed to solve the problem?
Description and Message
what I am trying to do is add a Battlefield 3 Online Stats block like the one on this vBulletin forum http://www.global-gamers.net/
I have the same PHP file as they have used on that site, the code from that file is below
Code: Select all
<?php
// Run POST Request via CURL
$c=curl_init('http://api.bf3stats.com/global/onlinestats/');
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);
$html_out = '<table>';
if (isset($data['pc'])){ $html_out .= '<tr><td align="right" style="color:#EFEFEF;font-weight:bold;">PC Players: </td> <td style="color:#FF9900;font-weight:bold;">'.number_format($data['pc']).'</td></tr>'; }
if (isset($data['ps3'])){ $html_out .= '<tr><td align="right" style="color:#EFEFEF;font-weight:bold;">PS3 Players: </td> <td style="color:#FF9900;font-weight:bold;">'.number_format($data['ps3']).'</td></tr>'; }
if (isset($data['360'])){ $html_out .= '<tr><td align="right" style="color:#EFEFEF;font-weight:bold;">XBox360 Players: </td> <td style="color:#FF9900;font-weight:bold;">'.number_format($data['360']).'</td></tr>'; }
$html_out .= '</table>';
echo $html_out;
}else{
echo "BF3 Stats API error status: ".$statuscode;
}
?>