mod_announce, MOTD

Hi,

I am new to ejabberd and would like to be able to set the MOTD programmatically using and xmlrpc call,
I am building an admin console in PHP and would like to know if the feature exists
where I can make this call via an API.

I would like my PHP Script to read a feed and then push the contents of this feed into ejabbered as the
MOTD

Kind regards

Deb

debonair wrote: Hi, I am new

debonair wrote:

Hi,

I am new to ejabberd and would like to be able to set the MOTD programmatically using and xmlrpc call,
I am building an admin console in PHP and would like to know if the feature exists
where I can make this call via an API.

I would like my PHP Script to read a feed and then push the contents of this feed into ejabbered as the
MOTD

Kind regards

Deb

I figured it out below is the answer

        $param['from'] = 'admin@test.im';
        $param['to'] = 'test.im/announce/motd';
        $param['body'] = 'This is the message of the day';
        $request = xmlrpc_encode_request('send_message_chat', $param, (array('encoding' => 'utf-8')));
        $context = stream_context_create(array(
                                             'http' => array(
                                             'method' => "POST",
                                             'header' => "User-Agent: XMLRPC::Client mod_xmlrpc\r\n" .
                                                         "Content-Type: text/xml\r\n" .
                                                         "Content-Length: " . strlen($request),
                                             'content' => $request
                                         )));

        $file = file_get_contents("http://test.im:4560/RPC2", false, $context);
        $response = xmlrpc_decode($file);
        print_r($response);

Syndicate content