I have used this https://github.com/xPaw/PHP-Source-Query API for querying ARK server information on a website. Everything works perfectly on localhost, but not when uploaded on the web server. PHP works otherwise on the server, but not just this one feature. The Apache error log on server says this when the page is loaded:
"PHP Parse error: syntax error, unexpected ''xPaw/SourceQuery
/SourceQuery'' (T_CONSTANT_ENCAPSED_STRING), expecting identifier
(T_STRING) or function (T_FUNCTION) or const (T_CONST) or \\\\
(T_NS_SEPARATOR) in /var/www/jamon/serverinfo.php on line 4, referer:
https://jamonparadigm.com/servers"
The web server is running PHP 7. The serverinfo.php looks like this:
<?php
require __DIR__ . '/SourceQuery/bootstrap.php';
use xPaw\SourceQuery\SourceQuery;
// For the sake of this example
Header( 'Content-Type: text/plain' );
Header( 'X-Content-Type-Options: nosniff' );
// The Island
define( 'SQ_SERVER_ADDR', '159.69.56.156' );
define( 'SQ_SERVER_PORT', 27000 );
define( 'SQ_TIMEOUT', 1 );
define( 'SQ_ENGINE', SourceQuery::SOURCE );
$Query = new SourceQuery( );
try
{
$Query->Connect( SQ_SERVER_ADDR, SQ_SERVER_PORT, SQ_TIMEOUT, SQ_ENGINE );
$islandInfo = $Query->GetInfo( );
$islandPlayers = $islandInfo['Players'] . "/" . $islandInfo['MaxPlayers'];
$islandVersion = trim(substr($islandInfo['HostName'], strpos($islandInfo['HostName'], '(')), "()");
$islandStatus = '<span class="text-success">online</span>';
$islandInfo2 = $Query->GetRules();
$islandDay = $islandInfo2['DayTime_s'];
}
catch( Exception $e )
{
$islandPlayers = "0/0";
$islandVersion = "";
$islandStatus = '<span class="text-danger">offline</span>';
$islandDay = "";
}
finally
{
$Query->Disconnect( );
}
?>
What could be done to fix the issue?