Placeholder Image

ADN Informatique

Consultant Ingénierie Informatique

Saguenay (Jonquière), Québec, Canada. Tél: (581) 683-9887 Téléc: (581) 221-0874

Placeholder Picture

Retour

xmlrpc client (2) - php

2005-06-22 21:04:02 (ID: 69, Parent: 0, Type: post)
#!/usr/local/php4/bin/php

include "xmlrpc-1.0.99.2/xmlrpc.inc";

//First attempt to use XML_RPC calls
//assert( $c=new xmlrpc_client("/", "sundev02.grafsoft.com", 8888) );
assert( $c=new xmlrpc_client("/~jlcyr/rpc_server.php", "192.168.2.21", 80) );
$c->setDebug(1);//never set it to 1 on an agi script..!!

////////////////////
// Envoie d'un fichier binaire
/*
$fn = "01.mp3";
$fich = fopen($fn,"rb");
$select = fread($fich,filesize($fn));
echo "filesize:".filesize($fn)."\n";
fclose($fich);
assert( $f=new xmlrpcmsg('doc.putDoc',array(new xmlrpcval($select,"base64"),new xmlrpcval($fn,"string"))) );
assert( $r=$c->send($f) );
$v=$r->value();
if ($r->faultCode())
  {
    //Insert error flag and message into db
    print "Fault: ";
    print "Code: " . $r->faultCode() . " Reason '" .$r->faultString()."'
";
  }
else
  {
    //Dump received return value
    print $v->scalarval();
  }
*/

//////////////////
// Demande des infos du RIS
//assert( $f=new xmlrpcmsg('ris.getCMD',array(new xmlrpcval("9999999","string"),new xmlrpcval("2","string"))) );
assert( $f=new xmlrpcmsg('doc.getDocInfo',array(new xmlrpcval("902","string"),
					    new xmlrpcval("fileset200525","string"),
					    new xmlrpcval("filename1.2.3","string"))));
assert( $r=$c->send($f) );
$v=$r->value();
if ($r->faultCode())
  {
    //Insert error flag and message into db
    print "Fault: ";
    print "Code: " . $r->faultCode() . " Reason '" .$r->faultString()."'
";
  }
else
  {
    //Dump received return value
    while (list($key,$item)=$v->structeach()) {
      print $key."=".$item->scalarval()."\n";
    }
  }

?>

Document Informatif

ADN Informatique

2015

Rev. 1

Jean-Luc Cyr