Browse files

Wrote createXmlRpcSuccessResponse()

  • Loading branch information...
1 parent 93e1b4c commit d2cf84cd5ec9143f261ec4f37af22d34dfcf83d2 @barnabywalters committed Jan 18, 2013
Showing with 20 additions and 0 deletions.
  1. +20 −0 BarnabyWalters/Helpers/Helpers.php
View
20 BarnabyWalters/Helpers/Helpers.php
@@ -536,6 +536,26 @@ public static function parseXmlRpcMethodCall($request) {
'params' => $paramArray
];
}
+
+ public static function createXmlRpcSuccessResponse($retVal, $asString = true) {
+ $doc = new DOMDocument('1.0');
+ $methodResponse = new DOMElement('methodResponse');
+ $response->appendChild($methodResponse);
+
+ $string = new DOMElement('string', $retVal);
+ $value = $response->createElement('value');
+ $value->appendChild($string);
+ $param = $response->createElement('param');
+ $param->appendChild($value);
+ $params = $response->createElement('params');
+ $params->appendChild($param);
+ $methodResponse->appendChild($params);
+
+ if (!$asString)
+ return $doc;
+ else
+ return $doc->saveXML();
+ }
}
// EOF Helpers.php

0 comments on commit d2cf84c

Please sign in to comment.