Hi, All!
I can't seem to find answer searching google and others
This is the error:
Fatal error: Call to undefined function: xmlrpc_encode_request() in /home/vids/public_html/includes/class.RevverAPI.php on line 36
This is line 36:
$request = xmlrpc_encode_request($method, $args);
This is the script:
<?php
/*
The RevverAPI class determines which method of packaging xmlrpc requests is to be
used, prepares and launches the method call and then returns the result as a standard
PHP variable. It requires curl support and will use the 'XMLRPC for PHP' library if
the built in XMLRPC functions for PHP are unavailable.
PHP
http://www.php.net/
XMLRPC
http://www.xmlrpc.com/
XMLRPC for PHP
http://www.php.net/xmlrpc
http://phpxmlrpc.sourceforge.net/
*/
class RevverAPI {
function RevverAPI($url) {
$this->url = $url;
$this->curl = function_exists('curl_init');
$this->xmlrpc = !function_exists('xmlrpc_encode_request');
}
function callRemote($method) {
// Curl is required so generate a fault if curl functions cannot be found.
if (!$this->curl) return array('faultCode' => -1, 'faultString' => 'Curl functions are unavailable.');
// The first argument will always be the method name while all remaining arguments need
// to be passed along with the call.
$args = func_get_args();
array_shift($args);
if ($this->xmlrpc) {
// If php has xmlrpc support use the built in functions.
$request = xmlrpc_encode_request($method, $args);
$result = $this->__xmlrpc_call($request);
$decodedResult = xmlrpc_decode($result);
} else {
// If no xmlrpc support is found, use the phpxmlrpc library. This involves containing
// all variables inside the xmlrpcval class.
$encapArgs = array();
foreach ($args as $arg) $encapArgs[] = $this->__phpxmlrpc_encapsulate($arg);
$msg = new xmlrpcmsg($method, $encapArgs);
$client = new xmlrpc_client($this->url);
$client->verifypeer = false;
$result = $client->send($msg);
if ($result->errno) {
$decodedResult = array('faultCode' => $result->errno, 'faultString' => $result->errstr);
} else {
$decodedResult = php_xmlrpc_decode($result->value());
}
}
return $decodedResult;
}
function __phpxmlrpc_encapsulate($arg) {
// The class xmlrpcval is defined in the phpxmlrpc library. It requires both the variable
// and the type. Dates are handled through the API as ISO 8601 string representations.
if (is_string($arg)) {
$encapArg = new xmlrpcval($arg, 'string');
} elseif (is_int($arg)) {
$encapArg = new xmlrpcval($arg, 'int');
} elseif (is_bool($arg)) {
$encapArg = new xmlrpcval($arg, 'boolean');
} elseif (is_array($arg)) {
// The API server treats indexed arrays (lists) and associative arrays (dictionaries)
// differently where in php they are essentially the same. Assuming that having a zero
// index set indicates an indexed array is not perfect but should suffice for the
// purpose of the API examples.
if (isset($arg[0])) {
$array = array();
foreach ($arg as $key => $value) {
$array[] = $this->__phpxmlrpc_encapsulate($value);
}
$encapArray = new xmlrpcval();
$encapArray->addArray($array);
$encapArg = $encapArray;
} else {
$struct = array();
foreach ($arg as $key => $value) {
$struct[$key] = $this->__phpxmlrpc_encapsulate($value);
}
$encapStruct = new xmlrpcval();
$encapStruct->addStruct($struct);
$encapArg = $encapStruct;
}
} else {
$encapArg = new xmlrpcval($arg, 'string');
}
return $encapArg;
}
function __xmlrpc_call($request) {
$header[] = "Content-type: text/xml";
$header[] = "Content-length: ".strlen($request);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
$data = curl_exec($ch);
if (curl_errno($ch)) {
// Curl errors are returned as emulated xmlrpc faults.
$errorCurl = curl_error($ch);
curl_close($ch);
return xmlrpc_encode(array('faultCode' => -1, 'faultString' => 'Curl Error : '.$errorCurl));
} else {
curl_close($ch);
return $data;
}
}
}
?>
THANKS for any help!
Joe






Bookmarks