Added: websites/staging/vcl/trunk/content/docs/xmlrpc__example_8php-example.html ============================================================================== --- websites/staging/vcl/trunk/content/docs/xmlrpc__example_8php-example.html (added) +++ websites/staging/vcl/trunk/content/docs/xmlrpc__example_8php-example.html Fri Feb 13 18:12:20 2015 @@ -0,0 +1,125 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> +<title>VCL XML RPC: xmlrpc_example.php</title> +<link href="xmlrpcdocs.css" rel="stylesheet" type="text/css" /> +</head><body> +<!-- Generated by Doxygen 1.5.5 --> +<div class="contents"> +<h1>xmlrpc_example.php</h1><div class="fragment"><pre class="fragment"><?php +<span class="comment">/*</span> +<span class="comment"> Licensed to the Apache Software Foundation (ASF) under one or more</span> +<span class="comment"> contributor license agreements. See the NOTICE file distributed with</span> +<span class="comment"> this work for additional information regarding copyright ownership.</span> +<span class="comment"> The ASF licenses this file to You under the Apache License, Version 2.0</span> +<span class="comment"> (the "License"); you may not use this file except in compliance with</span> +<span class="comment"> the License. You may obtain a copy of the License at</span> +<span class="comment"></span> +<span class="comment"> http://www.apache.org/licenses/LICENSE-2.0</span> +<span class="comment"></span> +<span class="comment"> Unless required by applicable law or agreed to in writing, software</span> +<span class="comment"> distributed under the License is distributed on an "AS IS" BASIS,</span> +<span class="comment"> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span> +<span class="comment"> See the License for the specific language governing permissions and</span> +<span class="comment"> limitations under the License.</span> +<span class="comment">*/</span> + +session_start(); + +$url = <span class="stringliteral">"http://{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}"</span>; +print <span class="stringliteral">"<a href=\"$url?state=test\">Test</a><br>\n"</span>; +print <span class="stringliteral">"<a href=\"$url?state=listimages\">List Available Images</a><br>\n"</span>; +print <span class="stringliteral">"<a href=\"$url?state=addrequest\">Add request for Maple 10</a><br>\n"</span>; +print <span class="stringliteral">"<a href=\"$url?state=requeststatus\">Get status of request</a><br>\n"</span>; +print <span class="stringliteral">"<a href=\"$url?state=connectdata\">Get connection data</a><br>\n"</span>; +print <span class="stringliteral">"<a href=\"$url?state=endrequest\">End request</a><br>\n"</span>; + +print <span class="stringliteral">"<pre>\n"</span>; + +<span class="comment">// test</span> +<span class="keywordflow">if</span>($_GET[<span class="stringliteral">'state'</span>] == <span class="stringliteral">'test'</span>) { + $rc = remoteVCLCall(<span class="stringliteral">'XMLRPCtest'</span>, array(<span class="stringliteral">'foo'</span>)); + print_r($rc); +} +<span class="comment">// list images</span> +elseif($_GET[<span class="stringliteral">'state'</span>] == <span class="stringliteral">'listimages'</span>) { + $rc = remoteVCLCall(<span class="stringliteral">'XMLRPCgetImages'</span>, array()); + print_r($rc); +} +<span class="comment">// add request</span> +elseif($_GET[<span class="stringliteral">'state'</span>] == <span class="stringliteral">'addrequest'</span>) { + $rc = remoteVCLCall(<span class="stringliteral">'XMLRPCaddRequest'</span>, array(98, <span class="stringliteral">'now'</span>, 60)); + <span class="keywordflow">if</span>($rc[<span class="stringliteral">'status'</span>] == <span class="stringliteral">'success'</span>) { + print <span class="stringliteral">"request id is {$rc['requestid']}<br>\n"</span>; + $_SESSION[<span class="stringliteral">'requestid'</span>] = $rc[<span class="stringliteral">'requestid'</span>]; + } + <span class="keywordflow">else</span> { + print_r($rc); + } +} +<span class="comment">// get request status</span> +elseif($_GET[<span class="stringliteral">'state'</span>] == <span class="stringliteral">'requeststatus'</span>) { + <span class="keywordflow">if</span>(! array_key_exists(<span class="stringliteral">'requestid'</span>, $_SESSION)) { + print <span class="stringliteral">"no request created<br>\n"</span>; + exit; + } + $rc = remoteVCLCall(<span class="stringliteral">'XMLRPCgetRequestStatus'</span>, array($_SESSION[<span class="stringliteral">'requestid'</span>])); + print <span class="stringliteral">"current status of request {$_SESSION['requestid']} is {$rc['status']}"</span>; +} +<span class="comment">// get connection data</span> +elseif($_GET[<span class="stringliteral">'state'</span>] == <span class="stringliteral">'connectdata'</span>) { + <span class="keywordflow">if</span>(! array_key_exists(<span class="stringliteral">'requestid'</span>, $_SESSION)) { + print <span class="stringliteral">"no request created<br>\n"</span>; + exit; + } + $rc = remoteVCLCall(<span class="stringliteral">'XMLRPCgetRequestConnectData'</span>, array($_SESSION[<span class="stringliteral">'requestid'</span>], $_SERVER[<span class="stringliteral">"REMOTE_ADDR"</span>])); + <span class="keywordflow">if</span>($rc[<span class="stringliteral">'status'</span>] == <span class="stringliteral">'ready'</span>) + print_r($rc); + <span class="keywordflow">else</span> + print <span class="stringliteral">"status of request is {$rc['status']}"</span>; +} +<span class="comment">// end request</span> +elseif($_GET[<span class="stringliteral">'state'</span>] == <span class="stringliteral">'endrequest'</span>) { + <span class="keywordflow">if</span>(! array_key_exists(<span class="stringliteral">'requestid'</span>, $_SESSION)) { + print <span class="stringliteral">"no request created<br>\n"</span>; + exit; + } + $rc = remoteVCLCall(<span class="stringliteral">'XMLRPCendRequest'</span>, array($_SESSION[<span class="stringliteral">'requestid'</span>])); + <span class="keywordflow">if</span>($rc[<span class="stringliteral">'status'</span>] == <span class="stringliteral">'error'</span>) + print_r($rc); + <span class="keywordflow">else</span> { + print <span class="stringliteral">"request ended<br>\n"</span>; + unset($_SESSION[<span class="stringliteral">'requestid'</span>]); + } +} +print <span class="stringliteral">"</pre>\n"</span>; + +function remoteVCLCall($method, $args) { + $request = xmlrpc_encode_request($method, $args); + $header = <span class="stringliteral">"Content-Type: text/xml\r\n"</span>; + $header .= <span class="stringliteral">"X-User: userid\r\n"</span>; <span class="comment">// user your userid here</span> + $header .= <span class="stringliteral">"X-Pass: password\r\n"</span>; <span class="comment">// user your password here</span> + $header .= <span class="stringliteral">"X-APIVERSION: 1"</span>; <span class="comment">// this is to allow for future changes to the api</span> + $context = stream_context_create( + array( + <span class="stringliteral">'http'</span> => array( + <span class="stringliteral">'method'</span> => <span class="stringliteral">"POST"</span>, + <span class="stringliteral">'header'</span> => $header, + <span class="stringliteral">'content'</span> => $request + ) + ) + ); + $file = file_get_contents(<span class="stringliteral">"https://vcl.ncsu.edu/scheduling/index.php?mode=xmlrpccall"</span>, <span class="keyword">false</span>, $context); + $response = xmlrpc_decode($file); + <span class="keywordflow">if</span>(xmlrpc_is_fault($response)) { + trigger_error(<span class="stringliteral">"xmlrpc: {$response['faultString']} ({$response['faultCode']})"</span>); + exit; + } + <span class="keywordflow">return</span> $response; +} +?> +</pre></div> </div> +<hr size="1"><address style="text-align: right;"><small>Generated on Wed May 20 10:32:08 2009 for VCL XML RPC by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address> +</body> +</html>
Added: websites/staging/vcl/trunk/content/docs/xmlrpcdocs.css ============================================================================== --- websites/staging/vcl/trunk/content/docs/xmlrpcdocs.css (added) +++ websites/staging/vcl/trunk/content/docs/xmlrpcdocs.css Fri Feb 13 18:12:20 2015 @@ -0,0 +1,139 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +body { + font-family: Tahoma, Geneva, sans-serif; + font-size: 1.1em; +} + +a { + text-decoration: none; + color: #3d3d82; +} + +h2 { + color: #3d3d82; +} + +a:hover { + text-decoration: underline; +} + +#projectname { + font-size: 3em; + font-weight: bold; +} + +.summary { + padding-top: 3px; + float: right; +} + +.title { + border-top: 1px solid; + font-size: 2em; + font-weight: bold; + padding: 5px 0 0 10px; +} + +.groupheader { + color: #3d3d82; + font-size: 1.6em; + font-weight: normal; + border-bottom: 1px solid; +} + +.memberdecls { + border-collapse: separate; + border-spacing: 0 0; +} + +.memItemLeft, +.mdescLeft { + padding-left: 15px; + background-color: #f8f8f8; +} + +.memItemRight { + background-color: #f8f8f8; +} + +.memItemRight a { + font-weight: bold; +} + +.mdescRight { + line-height: 160%; + background-color: #f8f8f8; +} + +.memSeparator { + font-size: 5px; + background-color: #f8f8f8; + border-bottom: 1px solid #ccc; +} + +.memitem { + border: 1px solid #3d3d82; + border-radius: 5px; + margin-bottom: 10px; +} + +.memproto { + background-color: #d1d7f6; + padding: 5px 5px 0 5px; + border-radius: 5px 5px 0 0; +} + +.memdoc { + padding: 0 5px 5px 5px; +} + +td.memname { + font-weight: bold; + color: #3d3d82; +} + +dt { + font-weight: bold; +} + +.paramname { + color: #6c2b32; + font-weight: bold; +} + +div.fragment { + border: 1px solid #b5baff; + border-radius: 8px; + padding: 8px; + background-color: #f8f8f8; +} + +.comment { + color: blue; +} + +.stringliteral { + color: #95181a; +} + +.keywordflow { + color: #dc821b; +}
