[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Demexp-dev] Lyu Web Client
From: |
Diogene Laerce |
Subject: |
[Demexp-dev] Lyu Web Client |
Date: |
Sat, 13 Oct 2007 11:35:05 +0700 |
Hello Lyu
> Bon, je suis en train de regarder comment communiquer avec le serveur
> demexp en javascript. Etant total neophyte, j'aimerais que quelqu'un
> m'explique un minimum sur quelle voie m'orienter...
I tried before to dialog with javascript, so you need a javascript bank
to manage xml-rpc. All the banks Ive found were a bit heavy and
complicated to understand for a newbie so I turned to php with the
xmlrpc2.2 :
http://phpxmlrpc.sourceforge.net/
And heres the code working for logging in as example :
<?php
include 'xmlrpc.inc';
//On verifie l'existence des variables $_POST['identifiant'] et
$_GET['password']
if(isset($_POST['identifiant'], $_POST['password']))
{
$login = new xmlrpcval($_POST['identifiant'], "string");
$pswd = new xmlrpcval($_POST['password'], "string");
}
// Object to represent the server
$server = new
xmlrpc_client("http://www.linux-france.org/cgi-bin/demexp-xmlrpc-demo");
// mode debug
//$server->setDebug(1);
// Send a message to the server.
$message = new xmlrpcmsg("login", array($login, $pswd));
$result = $server->send($message);
// Process the response.
if (!$result)
{
print "<p>Could not connect to demexp server.</p>";
}
elseif ($result->faultCode())
{
$fcv = $result->faultCode();
if($fcv = 410)
{
header('Location: error.html');
exit;
}elseif($fcv = 1)
{
header('Location: deconnexion.html');
exit;
}
print "<p>XML-RPC Fault #" . $result->faultCode() . ": " .
$result->faultString();
}
else
{
$cookie = $result->value();
if(!empty($cookie))
{
$cookie = $result->value()->scalarVal();
$name=demexp_login;
setCookie($name, $cookie, time()+7200);
$server->setCookie($cookie);
header('Location: demexp.html');
exit;
}
}
?>
I dont know what youre up to, but if you want we can try to coordonate
our efforts to build the server dialog. Unless you want to build your
own client : just let me know..
Yours
Diogene
- [Demexp-dev] Lyu Web Client,
Diogene Laerce <=