Home :: International :: Manuals :: Howto :: FAQ :: Man Pages :: Email Login

 
 

 

hw_api->object

(no version information, might be only in CVS)

hw_api->object -- Lit les informations d'attribut

Description

object hw_api->object ( array parameter)

hw_api->object() lit les informations d'attribut d'un objet de n'importe quelle version. Elle ne retournera pas le contenu du document. Le paramètre parameter est un tableau qui contient l'élément obligatoire 'objectIdentifier' et les éléments optionnels 'attributeSelector' et 'version'.

L'objet retourné est une instance de la classe HW_API_Object en cas de succès ou HW_API_Error en cas d'erreur.

Cet exemple simple lit un objet et vérifie les erreurs.

Exemple 1. Lit un objet Hyperwave et le vérifie

<?php
function handle_error($error)
{
  
$reason = $error->reason(0);
  echo
'Type: <b>';
  switch (
$reason->type()) {
    case
0:
      echo
'Erreur';
      break;
    case
1:
      echo
'Alerte';
      break;
    case
2:
      echo
'Message';
      break;
  }
  echo
"</b><br />\n";
  echo
"Description : " . $reason->description("en") . "<br />\n";
}

function
list_attr($obj)
{
  echo
"<table>\n";
  
$count = $obj->count();
  for (
$i=0; $i<$count; $i++) {
    
$attr = $obj->attribute($i);
    
printf("<tr><td align=\"right\" bgcolor=\"#c0c0c0\"><b>%s</b></td><td bgcolor=\"#F0F0F0\">%s</td></tr>\n",
             
$attr->key(), $attr->value());
  }
  echo
"</table>\n";
}

$hwapi = hwapi_hgcsp($g_config[HOSTNAME]);
$parms = array("objectIdentifier" => "rootcollection", "attributeSelector"=>array("Title", "Name", "DocumentType"));
$root = $hwapi->object($parms);
if (
get_class($root) == "HW_API_Error") {
  
handle_error($root);
  exit;
}
list_attr($root);
?>

Voir aussi hwapi_content().

 
 
 
 
Google
  Web Linuxinfor   
 

Home :: Copyright :: Privacy :: Credits :: Get a free Linuxinfor Email Account

Document on this page is part of "Manuel PHP". See Index Page for more info about Authorship and Copyright.

1999-2009 Linuxinfor.com. No rights reserved.