i just found out about this openfire thing a couple days ago and i’ve been trying to get it set up and have it working
but i ran into some problems.
for now i already install the plugins for the gateway and i test it and it says that the test is successful
so i assume that it should work no problem.
so i’m trying to use xmpphp to send message to other service using this gateway plugin but i have no luck.
i can use spark client to send message between people in my network and i can also use xmpphp to send
message to other people in my network and it still works but when i try to send the message to my other account
such as aim or msn it’s no longer working.
maybe it’s something simple but i wonder if you guys and help point me in a right direction here
here’s the code that i use that i got from xmpphp
include 'XMPPHP/XMPP.php'; $conn = new XMPPHP_XMPP('testing.domain.com', 5222, 'testtest', 'testing', 'xmpphp', 'testserver.com', $printlog=false, $loglevel=XMPPHP_Log::LEVEL_INFO); try {
$conn->connect();
$conn->processUntil('session_start');
$conn->presence();
$conn->message('aimtesting@aim.testserver.com', 'This is a test message from php code!');
$conn->disconnect();
} catch(XMPPHP_Exception $e) {
die($e->getMessage());
}
(all the names had be changed but it should show what i’m trying to do)
when i try to send a message to my aim account, it doesn’t seem to be getting though and i dont’ know what else to do if anyone can help me that would be great
if what you’re trying to do is trying to send a message to other gateway through the openfire with php then the the xmpphp is not what you’re looking for.
i’ve been going through the codes many times and i don’t think xmpphp can send message to other gateways without already be logged in that gateway in openfire before sending the message but it works great for sending message within openfire server
and i don’t think xmpphp supports gateway discovery and stuff. i might have been wrong about this but i found a new php library that work great
try {
$conn->connect();
$conn->processUntil(‘session_start’);
$conn->presence(“Ya, I’m online”,“available”,“aim.server_name”);
$conn->message(‘someaim@aim.server_name’, ‘This is a test message and i think it is working!’);
$conn->disconnect();
} catch(XMPPHP_Exception $e) {
die($e->getMessage());
}
BUT this code will work if you already signed in to that gateway in your openfire…
this is why i think that php jabber client is working better and have more options that you can choose for and stuff
i hope i’m explaining it somewhat clearly. if you have any questions please let me know
Essentially I am creating a web app that will send a message to users in out system (we have an internal jabber setup). So all I need is the ability to transmit a message.
I checked out PHP Jabber Client and they do not seperate host and domain (I have accross this a few times (even with spark web)) so I dont think this one will work.
i noticed that you ip starts with 192.168.xxx.xxx. is this like on your network/router or something?
well i think this might have to do with you ip address setting and your server.
i was reading this post about dns and ip address and i don’t know if this is something you’re have a problem with but you might wanna have a look.
and if this is the ip within your network/router then i don’t know what’s wrong with it because i used to use this 192.168.xxx.xxx for my jabber within the network between friends and it works fine so please let me know how it goes for you.
and if you can give me a little snippet of your code that would be great also so i can try it on my end see if it would work… or something that i might be able to help you out with
ps both xmpphp and jabber calls codes please if you can because for me xmpphp seems to be more straight forward then jabber class for what you’re trying to do in my opinion
Ok for anyone else having issues…xmpphp DOES work but you need to make sure your PHP has the Multi-Byte-String extension enabled. I altered my install of PHP and Presto! all works beautifully.
i have got a task to connect openfire server with xmpphp client. i tried hard but not got success. When i connect to openfire then only blankpage is shown.
code is as-
<?php
session_start();
header('content-type', 'plain/text');
// activate full error reporting
//error_reporting(E_ALL & E_STRICT);
include ("/XMPPHP/BOSH.php");
print "
";
#Use XMPPHP_Log::LEVEL_VERBOSE to get more logging for error reports
#If this doesn't work, are you running 64-bit PHP with < 5.2.6?
$conn = new XMPPHP_BOSH('10.1.0.23', 5222, 'admin', 'asdfghjkl', 'xmpphp', 'hitech.com', $printlog=true, $loglevel=XMPPHP_Log::LEVEL_INFO);
$conn->autoSubscribe();
try {
if(isset($_SESSION['messages'])) {
foreach($_SESSION['messages'] as $msg) {
print $msg;
flush();
}
}
$conn->connect('[http://10.1.0.23:7070/xmpp-httpbind](http://10.1.0.23:7070/xmpp-httpbind)', 1, true);
#while(true) {
$payloads = $conn->processUntil(array('message', 'presence', 'end_stream', 'session_start'));
foreach($payloads as $event) {
$pl = $event[1];
switch($event[0]) {
case 'message':
if(!isset($_SESSION['messages'])) $_SESSION['message'] = Array();
$msg = "------------------------------------------------------------------------------ ---\n{$pl['from']}: {$pl['body']}\n";
print $msg;
$_SESSION['messages'][] = $msg;
flush();
$conn->message($pl['from'], $body="Thanks for sending me \"{$pl['body']}\".", $type=$pl['type']);
if($pl['body'] == 'quit') $conn->disconnect();
if($pl['body'] == 'break') $conn->send("");
break;
case 'presence':
print "Presence: {$pl['from']} [{$pl['show']}] {$pl['status']}\n";
break;
case 'session_start':
print "Session Start\n";
$conn->getRoster();
$conn->presence($status="Cheese!");
break;
}
}
#}
} catch(XMPPHP_Exception $e) {
die($e->getMessage());
}
$conn->saveSession();
print "