2001-08-08 01:00:28 +02:00
|
|
|
<?php
|
|
|
|
// by Edd Dumbill (C) 1999-2001
|
|
|
|
// <edd@usefulinc.com>
|
|
|
|
// xmlrpc.inc,v 1.18 2001/07/06 18:23:57 edmundd
|
|
|
|
|
|
|
|
// License is granted to use or modify this software ("XML-RPC for PHP")
|
|
|
|
// for commercial or non-commercial use provided the copyright of the author
|
|
|
|
// is preserved in any distributed or derivative work.
|
|
|
|
|
|
|
|
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
|
|
|
|
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
class xmlrpcresp
|
|
|
|
{
|
|
|
|
var $xv = array();
|
|
|
|
var $fn;
|
|
|
|
var $fs;
|
|
|
|
var $hdrs;
|
|
|
|
|
|
|
|
function xmlrpcresp($val='', $fcode=0, $fstr='')
|
|
|
|
{
|
|
|
|
if ($fcode!=0)
|
|
|
|
{
|
|
|
|
$this->fn = $fcode;
|
|
|
|
$this->fs = htmlspecialchars($fstr);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if($val)
|
|
|
|
{
|
|
|
|
$this->xv = $val;
|
|
|
|
}
|
|
|
|
$this->fn = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function faultCode()
|
|
|
|
{
|
|
|
|
if (isset($this->fn))
|
|
|
|
{
|
|
|
|
return $this->fn;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function faultString()
|
|
|
|
{
|
|
|
|
return $this->fs;
|
|
|
|
}
|
|
|
|
|
|
|
|
function value()
|
|
|
|
{
|
|
|
|
return $this->xv;
|
|
|
|
}
|
|
|
|
|
|
|
|
function serialize()
|
|
|
|
{
|
2001-08-09 04:54:56 +02:00
|
|
|
$rs='<methodResponse>'."\n";
|
2001-08-08 01:00:28 +02:00
|
|
|
if ($this->fn)
|
|
|
|
{
|
2001-08-09 04:54:56 +02:00
|
|
|
$rs .= '<fault>
|
2001-08-08 01:00:28 +02:00
|
|
|
<value>
|
|
|
|
<struct>
|
|
|
|
<member>
|
|
|
|
<name>faultCode</name>
|
2001-08-09 04:54:56 +02:00
|
|
|
<value><int>' . $this->fn . '</int></value>
|
2001-08-08 01:00:28 +02:00
|
|
|
</member>
|
|
|
|
<member>
|
|
|
|
<name>faultString</name>
|
2001-08-09 04:54:56 +02:00
|
|
|
<value><string>' . $this->fs . '</string></value>
|
2001-08-08 01:00:28 +02:00
|
|
|
</member>
|
|
|
|
</struct>
|
|
|
|
</value>
|
2001-08-09 04:54:56 +02:00
|
|
|
</fault>';
|
2001-08-08 01:00:28 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-08-09 04:54:56 +02:00
|
|
|
$rs .= '<params>'."\n".'<param>'."\n".@$this->xv->serialize().'</param>'."\n".'</params>';
|
2001-08-08 01:00:28 +02:00
|
|
|
}
|
2001-08-09 04:54:56 +02:00
|
|
|
$rs.="\n".'</methodResponse>';
|
2001-08-08 01:00:28 +02:00
|
|
|
return $rs;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|