diff options
| author | ivan <ivan> | 2007-10-14 01:51:14 +0000 |
|---|---|---|
| committer | ivan <ivan> | 2007-10-14 01:51:14 +0000 |
| commit | fca4f67925d3d3e9e7a3eacc5df3a1b2a9f6c241 (patch) | |
| tree | bf76011bba7288d30a1515f9c3e803a867b0e56d /fs_selfservice/php/freeside.class.php | |
| parent | 512101feff03c4b3f75c22e2a480f4f4f726c7cb (diff) | |
adding php examples
Diffstat (limited to 'fs_selfservice/php/freeside.class.php')
| -rw-r--r-- | fs_selfservice/php/freeside.class.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/fs_selfservice/php/freeside.class.php b/fs_selfservice/php/freeside.class.php new file mode 100644 index 000000000..21e89b47f --- /dev/null +++ b/fs_selfservice/php/freeside.class.php @@ -0,0 +1,33 @@ +<?php +class FreesideSelfService { + + //Change this to match the location of your selfservice xmlrpc.cgi or daemon + var $URL = 'https://www.example.com/selfservice/xmlrpc.cgi'; + + function FreesideSelfService() { + $this; + } + + public function __call($name, $arguments) { + + error_log("[FreesideSelfService] $name called, sending to ". $this->URL); + + $request = xmlrpc_encode_request("FS.SelfService.XMLRPC.$name", $arguments); + $context = stream_context_create( array( 'http' => array( + 'method' => "POST", + 'header' => "Content-Type: text/xml", + 'content' => $request + ))); + $file = file_get_contents($this->URL, false, $context); + $response = xmlrpc_decode($file); + if (xmlrpc_is_fault($response)) { + trigger_error("[FreesideSelfService] XML-RPC communication error: $response[faultString] ($response[faultCode])"); + } else { + //error_log("[FreesideSelfService] $response"); + return $response; + } + } + +} + +?> |
