bulk provisioning via ftp and SOAP #5202
[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://localhost/selfservice/xmlrpc.cgi';
6     var $URL = 'http://localhost/selfservice/xmlrpc.cgi';
7
8     function FreesideSelfService() {
9       $this;
10     }
11
12     public function __call($name, $arguments) {
13
14         error_log("[FreesideSelfService] $name called, sending to ". $this->URL);
15
16         $request = xmlrpc_encode_request("FS.SelfService.XMLRPC.$name", $arguments);
17         $context = stream_context_create( array( 'http' => array(
18             'method' => "POST",
19             'header' => "Content-Type: text/xml",
20             'content' => $request
21         )));
22         $file = file_get_contents($this->URL, false, $context);
23         $response = xmlrpc_decode($file);
24         if (xmlrpc_is_fault($response)) {
25             trigger_error("[FreesideSelfService] XML-RPC communication error: $response[faultString] ($response[faultCode])");
26         } else {
27             //error_log("[FreesideSelfService] $response");
28             return $response;
29         }
30     }
31
32 }
33
34 ?>