<?php

/**
 * A simple class to wrap XML-RPC calls
 * @author Vinod Kumar<30.vinodkumar@gmail.com>
 * @version 1.0
 *
 */
class XMLRPC {
	
	private $host;
	private $location;

	public function __construct($host, $location) {
		
		$this->host = $host;
		$this->location = $location;
	}

	protected function call($xml) {

		$context = stream_context_create(array('http' => array(
		'method' => "POST",
		'header' => "Content-Type: text/xml\r\nUser-Agent: PHPRPC/1.0\r\nHost: $this->host\r\n",
		'content' => $xml
		)));

		$file = file_get_contents($this->location, false, $context);

		$response = xmlrpc_decode($file);

		/*if (is_array($response) and xmlrpc_is_fault($response)){
			echo "Failed to ping Technorati";
		} else {
			echo "Successfully pinged Technorati";
		}*/
		
		return $response;
	}
}
?>