3 if (count($argv) != 3) {
4 echo "usage: $argv[0] pagename revision\n";
7 if (!is_numeric($argv[2])) {
8 echo "usage: revision must be an integer\n";
12 $wsdl = getenv('PHPWIKI_WSDL_URL');
13 if ($wsdl === false) {
14 $wsdl = "http://phpwiki.fr/PhpWiki.wsdl";
18 $client = new SoapClient($wsdl);
19 } catch (SoapFault $fault) {
20 die($fault->faultstring);
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);
31 chmod($phpwiki, 0600);
34 $credentials = base64_encode(file_get_contents($phpwiki));
38 echo $client->getPageRevision($argv[1], $argv[2], $credentials);
40 } catch (SoapFault $e) {
41 echo 'Error: ' . $e->getMessage() . "\n";