On Mon, 15 May 2006, J. King wrote:

To further my understanding of how Jabber works I have decided I should try and write my own XMPP implementation in PHP. However, I've run into trouble rather quickly.

To connect to a Jabber server, one must open a TCP socket to the server (typically through port 5269) send an XML-based stream header, wait for the server's confirmation and then log in, etc. As an initial test I tried to open a TCP socket, send a stream header, get the server's response, then disconnect. I did so thusly:

 $server = "jabber.org"; //example server
 $port = 5269; //default port
 $nsStream = "http://etherx.jabber.org/streams";; // Streams namespace

 $socket = stream_socket_client("tcp://$server:$port");
$header = "<stream:stream to='$server' xmlns='jabber:client' xmlns:stream='$nsClient' xml:lang='en' version='1.0'>";
[snip]

 <stream:error>
  <invalid-namespace
    xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
 </stream:error>

What's the value of $nsClient??? I doesn't look like it's defined at all, so I would guess that your problem is there.

--
 21:50:04 up 2 days,  9:07,  0 users,  load average: 0.92, 0.37, 0.18
---------------------------------------------------------
Lic. Martín Marqués | SELECT 'mmarques' || Centro de Telemática | '@' || 'unl.edu.ar';
Universidad Nacional        |   DBA, Programador,
    del Litoral             |   Administrador
---------------------------------------------------------
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to