Giter Club home page Giter Club logo

opengsq-php's Introduction

OpenGSQ PHP Library

PHP Composer GitHub license Packagist Version Packagist Downloads

The OpenGSQ PHP library provides a convenient way to query servers from applications written in the PHP language.

Documentation

Detailed documentation is available at https://php.opengsq.com.

System Requirements

Installation

The recommended way to install the OpenGSQ PHP library is through Composer, a tool for dependency management in PHP. You can install it by running the following command in your terminal:

composer require opengsq/opengsq-php

Basic Usage

Here’s a quick example of how you can use the OpenGSQ library to query a server using the VCMP protocol:

<?php

// Include the Composer autoloader
require_once '../vendor/autoload.php';

// Import the Vcmp class from the OpenGSQ\Protocols namespace
use OpenGSQ\Protocols\Vcmp;

// Create a new Vcmp object with the specified host and port
$vcmp = new Vcmp('123.123.123.123', 8114);

// Get the status of the server
$status = $vcmp->getStatus();

// Output the status information
var_dump($status);

// Get the players on the server
$players = $vcmp->getPlayers();

// Output the player information
var_dump($players);

In this example, we first include the Composer autoloader and import the Vcmp class. We then create a new Vcmp object, specifying the host and port of the server we want to query. Finally, we call the getStatus and getPlayers methods to retrieve and output information about the server and its players.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Stargazers over time

Stargazers over time

opengsq-php's People

Contributors

battlefieldduck avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

opengsq-php's Issues

getInfo() does not work

I've tried all the possible combinations that I can think of but I haven't gotten the getInfo() function working once. It always throws an exception because the IP and post does not exist.

This is one of the examples I'm using:

<?php

// Include the Composer autoloader
require_once 'vendor/autoload.php';

// Import the Vcmp class from the OpenGSQ\Protocols namespace
use OpenGSQ\Protocols\EOS;

$clientId = 'xyza78916PZ5DF0fAahu4tnrKKyFpqRE';
$clientSecret = 'j0NapLEPm3R3EOrlQiM8cRLKq3Rt02ZVVwT0SkZstSg';
$deploymentId = '0a18471f93d448e2a1f60e47e03d3413';
$grantType = 'external_auth';
$externalAuthType = 'deviceid_access_token';

try {
    $externalAuthToken = EOS::getExternalAuthToken($clientId, $clientSecret, $externalAuthType);
    $accessToken = EOS::getAccessToken($clientId, $clientSecret, $deploymentId, $grantType, $externalAuthType, $externalAuthToken);
    $matchmaking = EOS::getMatchmaking($deploymentId, $accessToken);
    $eos = new EOS('34.22.86.173', '8211', $deploymentId, $accessToken);
    echo '<pre>';
    print_r($matchmaking);
    print_r($eos->getInfo());
} catch (Exception $e) {
    echo '<pre>';
    print_r($e);
}

The IP and port from the example is just a random server from the $matchmaking array.

Any idea why it does not work? Am I doing something wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.