]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - soapscripts/getpagerevision
Update jquery to 1.11.3
[SourceForge/phpwiki.git] / soapscripts / getpagerevision
1 #!/usr/bin/php
2 <?php
3 if (count($argv) != 3) {
4     echo "usage: $argv[0] pagename revision\n";
5     exit;
6 }
7 if (!is_numeric($argv[2])) {
8     echo "usage: revision must be an integer\n";
9     exit;
10 }
11
12 $wsdl = getenv('PHPWIKI_WSDL_URL');
13 if ($wsdl === false) {
14     $wsdl = "http://phpwiki.fr/PhpWiki.wsdl";
15 }
16
17 try {
18     $client = new SoapClient($wsdl);
19 } catch (SoapFault $fault) {
20     die($fault->faultstring);
21 }
22
23 $phpwiki = getenv("HOME")."/.phpwiki";
24 if (!file_exists($phpwiki)) {
25     $login = readline("Login: ");
26     $password = readline("Password: ");
27     $credentials = base64_encode($login.':'.$password);
28     if ($fp = fopen($phpwiki, 'w')) {
29         fprintf($fp, "%s:%s", $login, $password);
30         fclose($fp);
31         chmod($phpwiki, 0600);
32     }
33 } else {
34     $credentials = base64_encode(file_get_contents($phpwiki));
35 }
36
37 try {
38     echo $client->getPageRevision($argv[1], $argv[2], $credentials);
39     echo "\n";
40 } catch (SoapFault $e) {
41     echo 'Error: ' .  $e->getMessage() . "\n";
42 }