Difference between revisions of "Ryzom API/Guilds"

From EncyclopAtys

Jump to: navigation, search
(Created page with " Displays the list of all guilds. === Usage === <base URL>/guilds.php ==== Cache Duration ==== Returned XML has <cache> element with attributes created and expire (utc time...")
 
m (category)
Line 45: Line 45:
 
   } else {
 
   } else {
 
     echo "API failure";</syntaxhighlight>
 
     echo "API failure";</syntaxhighlight>
 +
<noinclude>[[Category:Ryzom API|{{subst:SUBPAGENAME}] ]]</noinclude>

Revision as of 07:50, 23 July 2020

Displays the list of all guilds.

Usage

<base URL>/guilds.php

Cache Duration

Returned XML has <cache> element with attributes created and expire (utc timestamp)

XML structure

<guilds>
  <cache created="1387371064" expire="1387374664"/>
  <shard>atys</shard>
  <guild>
    <gid>105906182</gid>
    <name>Atrium</name>
    <race>Fyros</race>
    <icon>575080624687965565</icon>
    <creation_date>131736955</creation_date>
    <description>Here you are the Keeper, your destiny is to make the rules to be respected</description>
  </guild>
  <guild>
    ....
  </guild>
</guilds>

PHP interface

ryzom_guildlist_api()

Function returns SimpleXMLElement object on success or boolean false on error.

<?php
  require_once "ryzomapi_lite.php";

  $guilds = ryzom_guildlist_api();
  if ($guilds !== false) {
    echo '<pre>';
    foreach($guilds->guild as $guild) {
      $gid = (int)$guild->gid;
      $name = htmlspecialchars($guild->name);
      echo "{$gid} {$name}\n";
    }
    echo '</pre>';
  } else {
    echo "API failure";