This commit was generated by cvs2svn to compensate for changes in r6252,
[freeside.git] / fs_selfservice / php / freeside.class.php
1 <?php
2 class FreesideSelfService  {
3
4     //Change this to match the location of your selfservice xmlrpc.cgi or daemon
5     var $URL = 'https://www.example.com/selfservice/xmlrpc.cgi';
6
7     function FreesideSelfService() {
8       $this;
9     }
10
11     public function __call($name, $arguments) {
12
13         error_log("[FreesideSelfService] $name called, sending to ". $this->URL);
14
15         $request = xmlrpc_encode_request("FS.SelfService.XMLRPC.$name", $arguments);
16         $context = stream_context_create( array( 'http' => array(
17             'method' => "POST",
18             'header' => "Content-Type: text/xml",
19             'content' => $request
20         )));
21         $file = file_get_contents($this->URL, false, $context);
22         $response = xmlrpc_decode($file);
23         if (xmlrpc_is_fault($response)) {
24             trigger_error("[FreesideSelfService] XML-RPC communication error: $response[faultString] ($response[faultCode])");
25         } else {
26             //error_log("[FreesideSelfService] $response");
27             return $response;
28         }
29     }
30
31 }
32
33 ?>