What I'm struggling with it is how to send a message from the
connected bot to another user via an existing connection so I don't
have to connect to server everytime I want to send a message? I'm
trying to send the message via another php instance or a webpage.
Also is the any better way to keep a bot connection alive instead of
the way I'm doing it right now?
Thanks in advanced
I need to do exactly the same thing. Any example please..
Thank you in advanced.
Same ERRORglobal $client....... $client->send_chat_msg('-1450041...@chat.facebook.com','hellojusttesting',null,null);
This is from my terminal here:$ php examples/echo_bot.php abhina...@jabber.org password.........
jaxl 1> global $client; $client->send_chat_msg("mailsforab...@gmail.com", "hey");
1. Add a new function in echo_bot.php
function sendMessage($to, $msg)
{
global $client;
$client->send_chat_msg($to, $msg);
}
<?php
require_once '../jaxl.php';
global $client;
$message = $argv[1];
$socket_file_name = $argv[2];
$socket = "unix:///PATH_TO_JAXL/.jaxl/sock/" . $socket_file_name;
$fp = stream_socket_client( $socket, $errno, $errstr);
if( !$fp )
{
printf( "ERROR: $errno - $errstr\n" );
}
else
{
fwrite( $fp,"$message\n" );
$response = fread( $fp, 1024 );
// printf( "$response\n" );
fclose( $fp );
}
> php send_message.php "sendMessage(\"1...@myxmppserver.com\", \"Hello this is jack sun from server --- demo \");" jaxl_35252.sock