Ive got this little snippet that I use to get data about what players are online in my server. The data displays correctly, I just have 1 extra empty row being echoed.
<?php
$id = ***; //service ID
$api_key = '***'; //CBSM API key
$act = 5; //action #5 indicates retrieval of online players
$response = null;
$ch = curl_init('https://api.envul.com/?s='.$id.'&api='.$api_key.'&act='.$act);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
if($response !== false) {
$response_data = explode("<hr>", $response); //process the data
foreach($response_data as $player_data)
{ // listing of players
$player_data = explode("{#!}", $player_data); //process the data
echo 'Username: '.$player_data[0].'<br>';
} //end listing of players
} else {
echo 'Error '.curl_error($ch);;
}
?>
Ive looked at countless posts on here and other sites about this issue with both curl
, and file_get_contents
.
Both methods return an empty string with and without actual data to display.