Hi David,
I'd like to know how I can retrieve questions, answers, votes, etc. I
tried to use the "question_info" method, but I do not understand the
server's reply because I only got a int value.
No, the question_info() method returns a quite complex data
structure. Here is part of its XDR (ONC-RPC) description:
Okay, let's consider a simpler case. What about the
max_question_id(cookie) function? The return value is of type:
struct max_question_id_return_t
{
return_code_t max_question_id_rc;
question_id_t max_question_id;
};
containing only a return code and the actual maximum question identifier
on the server.
So what I do in PHP is:
1/ Generate the properly formatted message to send to the server:
$message = xmlrpcmsg("max_question_id", $cookie);
2/ Send the message...
$xmlrpc_res = $server->send($message);
... but here my $xmlrpc_res value has no particular type. Should I
declare it as an array on the base of the max_question_id_return_t
structure?
Diogene suggested to me to take a look at Augustin's code under Dupral
(link or location?).
Lyu ABE
struct response_t {
response_desc_t r_info_desc;
external_link_t r_info_link;
};
enum question_status_e { tagging_only = 1, public = 2 };
struct question_t {
_int32 int q_timestamp;
question_id_t q_id;
question_desc_t q_desc;
date_t q_info_limit_date; /* if set to zero, there is no limit date */
question_status_e q_info_status;
response_t q_info_responses<MAX_NUMBER_RESPONSES>;
int q_info_num_votes;
int q_info_elected_responses<MAX_NUMBER_RESPONSES>;
};
struct question_info_return_t {
return_code_t question_info_rc;
question_t question_info<MAX_NUMBER_IDS>;
};
Roughly speaking, you have a basic structure (question_info_return_t)
that contains a return code (question_info_rc) and an array of question
information (question_info). Each entry of the `question_info' array is
a structure (question_t) that contains the question timestamp, its id,
its description, etc.
question_info() is probably not the simplest RPC to start with. Maybe
Diogene might help you on this.
My question is not "What am I doing wrong?", but rather "How to properly
do that?".
Without some code, it is quite difficult to answer such a question.
Yours,
d.
_______________________________________________
Demexp-dev mailing list
Demexp-dev@nongnu.org
http://lists.nongnu.org/mailman/listinfo/demexp-dev