| CODENOTIFIER | HelpYou are not signed inSign in |
Project: ejabberd-modules
Revision: 708
Author: badlop
Date: 31 Aug 2008 14:14:14
Changes:* README.txt: Fixed the PHP example (thanks to Calder)
Files:| ... | ...@@ -219,21 +219,26 @@ | |
| 219 | 219 | EXAMPLE IN PHP |
| 220 | 220 | -------------- |
| 221 | 221 | |
| 222 | This is an example XML-RPC client in PHP, thanks to Zbyszek Żółkiewski: | |
| 222 | This is an XML-RPC client in PHP, thanks to Zbyszek Żółkiewski and Calder. | |
| 223 | It requires "allow_url_fopen = On" in your php.ini. | |
| 224 | ||
| 223 | 225 | ------- |
| 224 | 226 | <? |
| 225 | $parm=array("user"=>"test_user","host"=>"example.com","password"=>"some_password"); | |
| 226 | $request = xmlrpc_encode_request("check_password",$parm); | |
| 227 | $param=array("user"=>"test_user","host"=>"example.com","password"=>"some_password"); | |
| 228 | $request = xmlrpc_encode_request('check_password', $param, (array('encoding' => 'utf-8'))); | |
| 227 | 229 | |
| 228 | 230 | $context = stream_context_create(array('http' => array( |
| 229 | 231 | 'method' => "POST", |
| 230 | 'header' => "Content-Type: text/xml; charset=utf-8\r\n" . | |
| 231 | "User-Agent: XMLRPC::Client mod_xmlrpc", | |
| 232 | 'header' => "User-Agent: XMLRPC::Client mod_xmlrpc\r\n" . | |
| 233 | "Content-Type: text/xml\r\n" . | |
| 234 | "Content-Length: ".strlen($request), | |
| 232 | 235 | 'content' => $request |
| 233 | 236 | ))); |
| 234 | 237 | |
| 235 | $file = file_get_contents("http://127.0.0.1:4666", false, $context); | |
| 238 | $file = file_get_contents("http://127.0.0.1:4560/RPC2", false, $context); | |
| 239 | ||
| 236 | 240 | $response = xmlrpc_decode($file); |
| 241 | ||
| 237 | 242 | if (xmlrpc_is_fault($response)) { |
| 238 | 243 | trigger_error("xmlrpc: $response[faultString] ($response[faultCode])"); |
| 239 | 244 | } else { |
| ... | ...@@ -1,3 +1,7 @@ | |
| 1 | 2008-08-31 Badlop <badlop@process-one.net> | |
| 2 | ||
| 3 | * README.txt: Fixed the PHP example (thanks to Calder) | |
| 4 | ||
| 1 | 5 | 2008-07-24 Badlop <badlop@process-one.net> |
| 2 | 6 | |
| 3 | 7 | * src/mod_xmlrpc.erl: Fixed typo in get_roster |