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...")
 
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
+
<noinclude>{{Trad|DE=Ryzom API/Gilden|EN=Ryzom API/Guilds|palette=api |H=1}}__TOC__</noinclude>
 
Displays the list of all guilds.
 
Displays the list of all guilds.
  
Line 45: Line 45:
 
   } else {
 
   } else {
 
     echo "API failure";</syntaxhighlight>
 
     echo "API failure";</syntaxhighlight>
 +
<noinclude>[[Category:Ryzom API|Guilds]]</noinclude>

Latest revision as of 11:43, 27 May 2023

de:Ryzom API/Gilden en:Ryzom API/Guilds
 
UnderConstruction.png
Translation to review
Don't blame the contributors, but come and help them 😎

Reference text ( Maintained text, used as reference ) :
Notes: (Leda, 2023-05-27)

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";