Modified: 
incubator/vcl/trunk/web/.ht-inc/xmlrpcdocs/xmlrpc__example_8php-example.html
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/web/.ht-inc/xmlrpcdocs/xmlrpc__example_8php-example.html?rev=783024&r1=783023&r2=783024&view=diff
==============================================================================
--- 
incubator/vcl/trunk/web/.ht-inc/xmlrpcdocs/xmlrpc__example_8php-example.html 
(original)
+++ 
incubator/vcl/trunk/web/.ht-inc/xmlrpcdocs/xmlrpc__example_8php-example.html 
Tue Jun  9 15:03:21 2009
@@ -1,123 +1,126 @@
-<!--
-  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.
--->
 <!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="doxygen.css" rel="stylesheet" type="text/css">
 <link href="tabs.css" rel="stylesheet" type="text/css">
 </head><body>
-<!-- Generated by Doxygen 1.5.3 -->
-<h1>xmlrpc_example.php</h1><div class="fragment"><pre class="fragment"><a 
name="l00001"></a>00001 &lt;?php
-<a name="l00002"></a>00002 session_start();
-<a name="l00003"></a>00003 
-<a name="l00004"></a>00004 $url = <span 
class="stringliteral">"http://{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}"</span>;
-<a name="l00005"></a>00005 print <span class="stringliteral">"&lt;a 
href=\"$url?state=test\"&gt;Test&lt;/a&gt;&lt;br&gt;\n"</span>;
-<a name="l00006"></a>00006 print <span class="stringliteral">"&lt;a 
href=\"$url?state=listimages\"&gt;List Available 
Images&lt;/a&gt;&lt;br&gt;\n"</span>;
-<a name="l00007"></a>00007 print <span class="stringliteral">"&lt;a 
href=\"$url?state=addrequest\"&gt;Add request for Maple 
10&lt;/a&gt;&lt;br&gt;\n"</span>;
-<a name="l00008"></a>00008 print <span class="stringliteral">"&lt;a 
href=\"$url?state=requeststatus\"&gt;Get status of 
request&lt;/a&gt;&lt;br&gt;\n"</span>;
-<a name="l00009"></a>00009 print <span class="stringliteral">"&lt;a 
href=\"$url?state=connectdata\"&gt;Get connection 
data&lt;/a&gt;&lt;br&gt;\n"</span>;
-<a name="l00010"></a>00010 print <span class="stringliteral">"&lt;a 
href=\"$url?state=endrequest\"&gt;End request&lt;/a&gt;&lt;br&gt;\n"</span>;
-<a name="l00011"></a>00011 
-<a name="l00012"></a>00012 print <span 
class="stringliteral">"&lt;pre&gt;\n"</span>;
-<a name="l00013"></a>00013 
-<a name="l00014"></a>00014 <span class="comment">// test</span>
-<a name="l00015"></a>00015 <span class="keywordflow">if</span>($_GET['state'] 
== 'test') {
-<a name="l00016"></a>00016         $rc = remoteVCLCall('<a name="a0"></a><a 
class="code" href="xmlrpcWrappers_8php.html#c3e09831835663a8bd79aab3f0ea3e69" 
title="this is a test function that call be called when getting XML RPC calls 
to this site...">XMLRPCtest</a>', array('foo'));
-<a name="l00017"></a>00017         print_r($rc);
-<a name="l00018"></a>00018 }
-<a name="l00019"></a>00019 <span class="comment">// list images</span>
-<a name="l00020"></a>00020 elseif($_GET['state'] == 'listimages') {
-<a name="l00021"></a>00021         $rc = remoteVCLCall('<a name="a1"></a><a 
class="code" href="xmlrpcWrappers_8php.html#e2c01a27349e7a7788a42cfb5fe0d5ab" 
title="gets the images to which the user has acces">XMLRPCgetImages</a>', 
array());
-<a name="l00022"></a>00022         print_r($rc);
-<a name="l00023"></a>00023 }
-<a name="l00024"></a>00024 <span class="comment">// add request</span>
-<a name="l00025"></a>00025 elseif($_GET['state'] == 'addrequest') {
-<a name="l00026"></a>00026         $rc = remoteVCLCall('<a name="a2"></a><a 
class="code" href="xmlrpcWrappers_8php.html#e6f9d40f20e08994fa3d82c8dd12bdf5" 
title="tries to make a request">XMLRPCaddRequest</a>', array(98, 'now', 60));
-<a name="l00027"></a>00027         <span 
class="keywordflow">if</span>($rc['status'] == 'success') {
-<a name="l00028"></a>00028                 print <span 
class="stringliteral">"request id is {$rc['requestid']}&lt;br&gt;\n"</span>;
-<a name="l00029"></a>00029                 $_SESSION['requestid'] = 
$rc['requestid'];
-<a name="l00030"></a>00030         }
-<a name="l00031"></a>00031         <span class="keywordflow">else</span> {
-<a name="l00032"></a>00032                 print_r($rc);
-<a name="l00033"></a>00033         }
-<a name="l00034"></a>00034 }
-<a name="l00035"></a>00035 <span class="comment">// get request status</span>
-<a name="l00036"></a>00036 elseif($_GET['state'] == 'requeststatus') {
-<a name="l00037"></a>00037         <span class="keywordflow">if</span>(! 
array_key_exists('requestid', $_SESSION)) {
-<a name="l00038"></a>00038                 print <span 
class="stringliteral">"no request created&lt;br&gt;\n"</span>;
-<a name="l00039"></a>00039                 exit;
-<a name="l00040"></a>00040         }
-<a name="l00041"></a>00041         $rc = remoteVCLCall('<a name="a3"></a><a 
class="code" href="xmlrpcWrappers_8php.html#131560f1aa7577bd1da62d5b7e228e4c" 
title="determines and returns the status of the 
request">XMLRPCgetRequestStatus</a>', array($_SESSION['requestid']));
-<a name="l00042"></a>00042         print <span class="stringliteral">"current 
status of request {$_SESSION['requestid']} is {$rc['status']}"</span>;
-<a name="l00043"></a>00043 }
-<a name="l00044"></a>00044 <span class="comment">// get connection data</span>
-<a name="l00045"></a>00045 elseif($_GET['state'] == 'connectdata') {
-<a name="l00046"></a>00046         <span class="keywordflow">if</span>(! 
array_key_exists('requestid', $_SESSION)) {
-<a name="l00047"></a>00047                 print <span 
class="stringliteral">"no request created&lt;br&gt;\n"</span>;
-<a name="l00048"></a>00048                 exit;
-<a name="l00049"></a>00049         }
-<a name="l00050"></a>00050         $rc = remoteVCLCall('<a name="a4"></a><a 
class="code" href="xmlrpcWrappers_8php.html#f8b8c718ea7ea9cc973602a2fe9ae20e" 
title="if request is ready, adds the connecting user&amp;#39;s computer to the 
request and returns...">XMLRPCgetRequestConnectData</a>', 
array($_SESSION['requestid'], $_SERVER[<span 
class="stringliteral">"REMOTE_ADDR"</span>]));
-<a name="l00051"></a>00051         <span 
class="keywordflow">if</span>($rc['status'] == 'ready')
-<a name="l00052"></a>00052                 print_r($rc);
-<a name="l00053"></a>00053         <span class="keywordflow">else</span>
-<a name="l00054"></a>00054                 print <span 
class="stringliteral">"status of request is {$rc['status']}"</span>;
-<a name="l00055"></a>00055 }
-<a name="l00056"></a>00056 <span class="comment">// end request</span>
-<a name="l00057"></a>00057 elseif($_GET['state'] == 'endrequest') {
-<a name="l00058"></a>00058         <span class="keywordflow">if</span>(! 
array_key_exists('requestid', $_SESSION)) {
-<a name="l00059"></a>00059                 print <span 
class="stringliteral">"no request created&lt;br&gt;\n"</span>;
-<a name="l00060"></a>00060                 exit;
-<a name="l00061"></a>00061         }
-<a name="l00062"></a>00062         $rc = remoteVCLCall('<a name="a5"></a><a 
class="code" href="xmlrpcWrappers_8php.html#dfdaad6201dbcaaf5c2249a2c38437cc" 
title="ends/deletes a request">XMLRPCendRequest</a>', 
array($_SESSION['requestid']));
-<a name="l00063"></a>00063         <span 
class="keywordflow">if</span>($rc['status'] == 'error')
-<a name="l00064"></a>00064                 print_r($rc);
-<a name="l00065"></a>00065         <span class="keywordflow">else</span> {
-<a name="l00066"></a>00066                 print <span 
class="stringliteral">"request ended&lt;br&gt;\n"</span>;
-<a name="l00067"></a>00067                 unset($_SESSION['requestid']);
-<a name="l00068"></a>00068         }
-<a name="l00069"></a>00069 }
-<a name="l00070"></a>00070 print <span 
class="stringliteral">"&lt;/pre&gt;\n"</span>;
-<a name="l00071"></a>00071 
-<a name="l00072"></a>00072 function remoteVCLCall($method, $args) {
-<a name="l00073"></a>00073         $request = xmlrpc_encode_request($method, 
$args);
-<a name="l00074"></a>00074         $header  = <span 
class="stringliteral">"Content-Type: text/xml\r\n"</span>;
-<a name="l00075"></a>00075         $header .= <span 
class="stringliteral">"X-User: userid\r\n"</span>;    <span class="comment">// 
user your userid here</span>
-<a name="l00076"></a>00076         $header .= <span 
class="stringliteral">"X-Pass: password\r\n"</span>;  <span class="comment">// 
user your password here</span>
-<a name="l00077"></a>00077         $header .= <span 
class="stringliteral">"X-APIVERSION: 1"</span>;       <span class="comment">// 
this is to allow for future changes to the api</span>
-<a name="l00078"></a>00078         $context = stream_context_create(
-<a name="l00079"></a>00079                 array(
-<a name="l00080"></a>00080                         'http' =&gt; array(
-<a name="l00081"></a>00081                                 'method' =&gt; 
<span class="stringliteral">"POST"</span>,
-<a name="l00082"></a>00082                                 'header' =&gt; 
$header,
-<a name="l00083"></a>00083                                 'content' =&gt; 
$request
-<a name="l00084"></a>00084                         )
-<a name="l00085"></a>00085                 )
-<a name="l00086"></a>00086         );
-<a name="l00087"></a>00087         $file = file_get_contents(<span 
class="stringliteral">"https://vcl.ncsu.edu/scheduling/index.php?mode=xmlrpccall";</span>,
 <span class="keyword">false</span>, $context);
-<a name="l00088"></a>00088         $response = xmlrpc_decode($file);
-<a name="l00089"></a>00089         <span 
class="keywordflow">if</span>(xmlrpc_is_fault($response)) {
-<a name="l00090"></a>00090                 trigger_error(<span 
class="stringliteral">"xmlrpc: {$response['faultString']} 
({$response['faultCode']})"</span>);
-<a name="l00091"></a>00091                 exit;
-<a name="l00092"></a>00092         }
-<a name="l00093"></a>00093         <span class="keywordflow">return</span> 
$response;
-<a name="l00094"></a>00094 }
-<a name="l00095"></a>00095 ?&gt;
-</pre></div> <hr size="1"><address style="text-align: right;"><small>Generated 
on Wed Dec 19 11:28:46 2007 for VCL XML RPC by&nbsp;
+<!-- Generated by Doxygen 1.5.5 -->
+<div class="contents">
+<h1>xmlrpc_example.php</h1><div class="fragment"><pre class="fragment">&lt;?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">"&lt;a 
href=\"$url?state=test\"&gt;Test&lt;/a&gt;&lt;br&gt;\n"</span>;
+print <span class="stringliteral">"&lt;a 
href=\"$url?state=listimages\"&gt;List Available 
Images&lt;/a&gt;&lt;br&gt;\n"</span>;
+print <span class="stringliteral">"&lt;a href=\"$url?state=addrequest\"&gt;Add 
request for Maple 10&lt;/a&gt;&lt;br&gt;\n"</span>;
+print <span class="stringliteral">"&lt;a 
href=\"$url?state=requeststatus\"&gt;Get status of 
request&lt;/a&gt;&lt;br&gt;\n"</span>;
+print <span class="stringliteral">"&lt;a 
href=\"$url?state=connectdata\"&gt;Get connection 
data&lt;/a&gt;&lt;br&gt;\n"</span>;
+print <span class="stringliteral">"&lt;a href=\"$url?state=endrequest\"&gt;End 
request&lt;/a&gt;&lt;br&gt;\n"</span>;
+
+print <span class="stringliteral">"&lt;pre&gt;\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']}&lt;br&gt;\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&lt;br&gt;\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&lt;br&gt;\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&lt;br&gt;\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&lt;br&gt;\n"</span>;
+                unset($_SESSION[<span 
class="stringliteral">'requestid'</span>]);
+        }
+}
+print <span class="stringliteral">"&lt;/pre&gt;\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> =&gt; array(
+                                <span class="stringliteral">'method'</span> 
=&gt; <span class="stringliteral">"POST"</span>,
+                                <span class="stringliteral">'header'</span> 
=&gt; $header,
+                                <span class="stringliteral">'content'</span> 
=&gt; $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;
+}
+?&gt;
+</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&nbsp;
 <a href="http://www.doxygen.org/index.html";>
-<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 
</small></address>
+<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 
</small></address>
 </body>
 </html>


Reply via email to