1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-04 18:29:40 +02:00
ampache/modules/xmlrpc/doc/apidocs.html
Karl 'vollmerk' Vollmer bcad40a05a New Import
2005-06-09 16:34:40 +00:00

598 lines
No EOL
8.8 KiB
HTML

<HTML
><HEAD
><TITLE
>Class documentation</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.77+"><LINK
REV="MADE"
HREF="edd@usefulinc.com"><LINK
REL="HOME"
TITLE="XML-RPC for PHP"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="The Jellyfish Book"
HREF="jellyfish.html"><LINK
REL="NEXT"
TITLE="xmlrpcmsg"
HREF="xmlrpcmsg.html"></HEAD
><BODY
CLASS="CHAPTER"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>XML-RPC for PHP: version 1.1</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="jellyfish.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="xmlrpcmsg.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="APIDOCS"
></A
>Chapter 5. Class documentation</H1
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
><A
HREF="apidocs.html#XMLRPC-CLIENT"
>xmlrpc_client</A
></DT
><DT
><A
HREF="xmlrpcmsg.html"
>xmlrpcmsg</A
></DT
><DT
><A
HREF="xmlrpcresp.html"
>xmlrpcresp</A
></DT
><DT
><A
HREF="xmlrpcval.html"
>xmlrpcval</A
></DT
><DT
><A
HREF="xmlrpc-server.html"
>xmlrpc_server</A
></DT
></DL
></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="XMLRPC-CLIENT"
></A
>xmlrpc_client</H1
><P
>This is the basic class used to represent a client of an
XML-RPC server.</P
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN174"
></A
>Creation</H2
><P
>The constructor has the following syntax:</P
><DIV
CLASS="FUNCSYNOPSIS"
><A
NAME="AEN177"
></A
><P
></P
><P
><CODE
><CODE
CLASS="FUNCDEF"
>$client=new xmlrpc_client</CODE
>($server_path, $server_hostname, $server_port);</CODE
></P
><P
></P
></DIV
><P
>Here's an example client set up to query Userland's XML-RPC
server at <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>betty.userland.com</I
></SPAN
>:</P
><PRE
CLASS="PROGRAMLISTING"
>$client=new xmlrpc_client("/RPC2", "betty.userland.com", 80);</PRE
><P
>The <TT
CLASS="PARAMETER"
><I
>server_port</I
></TT
> parameter is
optional, and if omitted will default to 80 when using
HTTP and 443 when using HTTPS (see the "send" method below.)</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN191"
></A
>Methods</H2
><P
>This class supports the following methods.</P
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="XMLRPC-CLIENT-SEND"
></A
>send</H3
><P
>This method takes the form:</P
><DIV
CLASS="FUNCSYNOPSIS"
><A
NAME="AEN197"
></A
><P
></P
><P
><CODE
><CODE
CLASS="FUNCDEF"
>$response=$client-&#62;send</CODE
>($xmlrpc_message, $timeout, $server_method);</CODE
></P
><P
></P
></DIV
><P
>Where <TT
CLASS="PARAMETER"
><I
>$xmlrpc_message</I
></TT
> is an
instance of <TT
CLASS="CLASSNAME"
>xmlrpcmsg</TT
> (see <A
HREF="xmlrpcmsg.html"
>xmlrpcmsg</A
>), and
<TT
CLASS="PARAMETER"
><I
>$response</I
></TT
> is an
instance of <TT
CLASS="CLASSNAME"
>xmlrpcresp</TT
> (see <A
HREF="xmlrpcresp.html"
>xmlrpcresp</A
>).</P
><P
>The <TT
CLASS="PARAMETER"
><I
>$timeout</I
></TT
> is optional, and
will be set to <TT
CLASS="LITERAL"
>0</TT
> (wait forever) if
omitted. This timeout value is passed to
<TT
CLASS="FUNCTION"
>fsockopen()</TT
>.</P
><P
>The <TT
CLASS="PARAMETER"
><I
>server_method</I
></TT
> parameter is
optional, and if omitted will default to 'http'. The only
other valid value is 'https', which will use an SSL HTTP
connection to connect to the remote server. Note that your
PHP must have the "curl" extensions compiled in in order to
use this feature. Note that when using SSL you should
normally set your port number to 443, unless the SSL server
you are contacting runs at any other port.</P
><DIV
CLASS="WARNING"
><P
></P
><TABLE
CLASS="WARNING"
BORDER="1"
WIDTH="100%"
><TR
><TD
ALIGN="CENTER"
><B
>Warning</B
></TD
></TR
><TR
><TD
ALIGN="LEFT"
><P
>PHP 4.0.2 or greater is required for SSL
functionality.
PHP 4.0.6 has a bug which prevents SSL
working.</P
></TD
></TR
></TABLE
></DIV
><P
>If the value of <TT
CLASS="PARAMETER"
><I
>$response</I
></TT
> is
<TT
CLASS="LITERAL"
>0</TT
> rather than an
<TT
CLASS="CLASSNAME"
>xmlrpcresp</TT
> object, then this
signifies an I/O error has occured. You can find out what
the I/O error was from the values
<TT
CLASS="FUNCTION"
>$client-&#62;errno</TT
> and
<TT
CLASS="FUNCTION"
>$client-&#62;errstring</TT
>.
</P
><P
>In addition to low-level errors, the XML-RPC server you
were querying may return an error in the
<TT
CLASS="CLASSNAME"
>xmlrpcresp</TT
> object. See <A
HREF="xmlrpcresp.html"
>xmlrpcresp</A
> for details of
how to handle these errors.
</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN230"
></A
>setCredentials</H3
><DIV
CLASS="FUNCSYNOPSIS"
><A
NAME="AEN232"
></A
><P
></P
><P
><CODE
><CODE
CLASS="FUNCDEF"
>$client-&#62;setCredentials</CODE
>($username, $password);</CODE
></P
><P
></P
></DIV
><P
>This method sets the username and password for authorizing the
client to a server. With the default (HTTP) transport, this
information is used for HTTP Basic authorization.
</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN240"
></A
>setCertificate</H3
><DIV
CLASS="FUNCSYNOPSIS"
><A
NAME="AEN242"
></A
><P
></P
><P
><CODE
><CODE
CLASS="FUNCDEF"
>$client-&#62;setCertificate</CODE
>($certificate, $passphrase);</CODE
></P
><P
></P
></DIV
><P
>This method sets the optional certificate and passphrase
used in SSL-enabled communication with a remote server
(when the <TT
CLASS="PARAMETER"
><I
>server_method</I
></TT
> is set to
'https' in the client's construction).
</P
><P
>The <TT
CLASS="PARAMETER"
><I
>certificate</I
></TT
> parameter must
be the filename of a PEM formatted certificate. The
<TT
CLASS="PARAMETER"
><I
>passphrase</I
></TT
> parameter must contain
the password required to use the certificate.</P
><P
>This requires the "curl" extensions to be compiled
into your installation of PHP.</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN255"
></A
>setSSLVerifyPeer</H3
><DIV
CLASS="FUNCSYNOPSIS"
><A
NAME="AEN257"
></A
><P
></P
><P
><CODE
><CODE
CLASS="FUNCDEF"
>$client-&#62;setSSLVerifyPeer</CODE
>($i);</CODE
></P
><P
></P
></DIV
><P
>This method defines whether connections made to XMLRPC
backends via HTTPS should verify the remote host's SSL
certificate, and cause the connection to fail if the cert
verification fails. $i should be a boolean value.
</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN263"
></A
>setSSLVerifyHost</H3
><DIV
CLASS="FUNCSYNOPSIS"
><A
NAME="AEN265"
></A
><P
></P
><P
><CODE
><CODE
CLASS="FUNCDEF"
>$client-&#62;setSSLVerifyHost</CODE
>($i);</CODE
></P
><P
></P
></DIV
><P
>This method defines whether connections made to XMLRPC
backends via HTTPS should verify the remote host's SSL
certificate's common name (CN). By default, only the existence
of a CN is checked. $i should be an integer value; 0 to not
check the CN at all, 1 to merely check for its existence, and
2 to check that the CN on the certificate matches the hostname
that is being connected to.
</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN271"
></A
>setDebug</H3
><DIV
CLASS="FUNCSYNOPSIS"
><A
NAME="AEN273"
></A
><P
></P
><P
><CODE
><CODE
CLASS="FUNCDEF"
>$client-&#62;setDebug</CODE
>($debugOn);</CODE
></P
><P
></P
></DIV
><P
><TT
CLASS="PARAMETER"
><I
>$debugOn</I
></TT
> is either
<TT
CLASS="LITERAL"
>0</TT
> or <TT
CLASS="LITERAL"
>1</TT
> depending on
whether you require the client to print debugging
information to the browser. The default is not to output
this information.</P
><P
> The debugging information includes the raw data returned
from the XML-RPC server it was querying, and the PHP value
the client attempts to create to represent the value
returned by the server. This option can be very useful when
debugging servers as it allows you to see exactly what the
server returns.
</P
></DIV
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="jellyfish.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="xmlrpcmsg.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>The Jellyfish Book</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>xmlrpcmsg</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>