Query API please help
#1

Hi, i'm using QueryAPI by waste https://sampforum.blast.hk/showthread.php?tid=104299 . I tried to test it on my local host using WAMP. I started my server on but it restore empty queries on my PHP page. Here's my PHP code.

PHP код:
<?php
require "SampQueryAPI.php";
$query = new SampQueryAPI('localhost''7777');
if(
$query->isOnline())
{
    
$aInformation $query->getInfo();
    
$aServerRules $query->getRules();
    
    
?>
    <b>Informazioni Generali</b>
    <table width="400">
        <tr>
            <td>NomeServer</td>
            <td><?= htmlentities($aInformation['hostname']) ?></td>
        </tr>
        <tr>
            <td>Gamemode</td>
            <td><?= htmlentities($aInformation['gamemode']) ?></td>
        </tr>
        <tr>
            <td>Giocatori</td>
            <td><?= $aInformation['players'?> / <?= $aInformation['maxplayers'?></td>
        </tr>
        <tr>
            <td>Mappa</td>
            <td><?= htmlentities($aInformation['mapname']) ?></td>
        </tr>
        <tr>
            <td>Tempo</td>
            <td><?= $aServerRules['weather'?></td>
        </tr>
        <tr>
            <td>Ora</td>
            <td><?= $aServerRules['worldtime'?></td>
        </tr>
        <tr>
            <td>Versione</td>
            <td><?= $aServerRules['version'?></td>
        </tr>
        <tr>
            <td>Password</td>
            <td><?= $aInformation['password'] ? 'Yes' 'No' ?></td>
        </tr>
    </table>
    <br />
    <b>Giocatori Online</b>
    <?php
    
    $aPlayers 
$query->getDetailedPlayers();
    
    if(!
is_array($aPlayers) || count($aPlayers) == 0)
    {
        echo 
'<br /><i>Nessuno</i>';
    }
    else
    {
        
?>
        <table width="400">
            <tr>
                <td><b>ID Giocatore</b></td>
                <td><b>Nickname</b></td>
                <td><b>Punteggio</b></td>
                <td><b>Ping</b></td>
            </tr>
        <?php
        
foreach($aPlayers as $sValue)
        {
            
?>
            <tr>
                <td><?= $sValue['playerid'?></td>
                <td><?= htmlentities($sValue['nickname']) ?></td>
                <td><?= $sValue['score'?></td>
                <td><?= $sValue['ping'?></td>
            </tr>
            <?php
        
}
    
        echo 
'</table>';
    }
}
else { echo 
'Server offline'; }
?>
Here's the results on my PHP page when i turn the server on.

Код:
General Info
Server Name
Gamemode
Players /
Map
Weather
Time
Version
Password

Players Online
No one
Reply


Messages In This Thread
Query API please help - by TheArcher - 22.02.2012, 17:20
Re: Query API please help - by royal_king - 22.02.2012, 17:41
Re: Query API please help - by TheArcher - 22.02.2012, 18:05
Re: Query API please help - by royal_king - 02.03.2012, 14:22
Re: Query API please help - by TheArcher - 02.03.2012, 14:53
Re: Query API please help - by royal_king - 03.03.2012, 08:57

Forum Jump:


Users browsing this thread: 1 Guest(s)