PHP code example of magicoli / opensim-rest-php

1. Go to this page and download the library: Download magicoli/opensim-rest-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

magicoli / opensim-rest-php example snippets




$session = opensim_rest_session(
  array(
    'uri' => "yourgrid.org:8009",
    'ConsoleUser' => 'yourConsoleUsername',
    'ConsolePass' => 'yourConolePassword',
  )
);

if ( is_opensim_rest_error($session) ) {
  error_log( "OpenSim_Rest error: " . $session->getMessage() );
} else {
  $responseLines = $session->sendCommand($command);
}

# Return value: an array containing the line(s) of response or a PHP Error