<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META content="MSHTML 5.00.2614.3500" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Dear,</FONT></DIV>
<DIV><FONT face=Arial size=2> We are developing a
PHP client for Jabber Server(Jabber.org). We would like your help in the
following areas:</FONT></DIV>
<DIV><FONT face=Arial size=2>1) We are not able to read the XML streams returned
from the Jabber Server.</FONT></DIV>
<DIV><FONT face=Arial size=2>2) We are unable to determine whether the
connection has been established (With the stream specified in your manual is it
neccessary to open a persistant connection with the jabber server)</FONT></DIV>
<DIV><FONT face=Arial size=2>3) Send us details about recieving XML Streams sent
by the server to the client</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>We are attaching the code also:-</FONT></DIV>
<DIV><FONT face=Arial size=2>(File Jab11.php3)</FONT></DIV>
<DIV><FONT face=Arial size=2><?php</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>$file = "c.xml";<BR> $fp =
pfsockopen("etherx.jabber.org",5222); </FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>function
trustedFile($file)<BR>{<BR> // only trust local files owned by
ourselves<BR> if (!eregi("^([a-z]+)://", $file) &&
fileowner($file) == getmyuid()) {<BR>
return true;<BR> }<BR> return
false;<BR>}</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>function startElement($parser, $name,
$attribs)<BR>{<BR> print "&lt;<font
color=\"#0000cc\">$name</font>";<BR> if
(sizeof($attribs)) {<BR> while
(list($k, $v) = each($attribs))
{<BR> print "
<font color=\"#009900\">$k</font>=\"<font
color=\"#990000\">$v</font>\"";<BR>
}<BR> }<BR> print
"&gt;";<BR>}</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>function endElement($parser,
$name)<BR>{<BR> print "&lt;/<font
color=\"#0000cc\">$name</font>&gt;";<BR>}</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>function characterData($parser,
$data)<BR>{<BR> print
"<b>$data</b>";<BR>}</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>function PIHandler($parser, $target,
$data)<BR>{<BR> switch (strtolower($target))
{<BR> case
"php":<BR>
global
$parser_file;<BR>
// If the parsed document is "trusted", we say it is
safe<BR> // to
execute PHP code inside it. If not, display the
code<BR> //
instead.<BR>
if (trustedFile($parser_file[$parser]))
{<BR>
eval($data);<BR>
} else
{<BR>
printf("Untrusted PHP code: <i>%s</i>",
htmlspecialchars($data));<BR>
}<BR>
break;<BR> }<BR>}</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>function defaultHandler($parser,
$data)<BR>{<BR> if (substr($data, 0, 1) == "&" &&
substr($data, -1, 1) == ";") {<BR>
printf('<font color="#aa00aa">%s</font>',
htmlspecialchars($data));<BR> } else
{<BR> printf('<font
size="-1">%s</font>', htmlspecialchars($data));<BR>
}<BR>}</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>function externalEntityRefHandler($parser,
$openEntityNames, $base,
$systemId,<BR>
$publicId)<BR>{<BR> if ($systemId)
{<BR> if (!list($parser, $fp) =
new_xml_parser($systemId))
{<BR>
printf("Could not open entity %s at %s\n",
$openEntityNames,<BR>
$systemId);<BR>
return false;<BR>
}<BR> while ($data = fread($fp, 4096))
{<BR> if
(!xml_parse($parser, $data, feof($fp)))
{<BR>
printf("XML error: %s at line %d while parsing entity
%s\n",<BR>
xml_error_string(xml_get_error_code($parser)),<BR>
xml_get_current_line_number($parser),
$openEntityNames);<BR>
xml_parser_free($parser);<BR>
return
false;<BR>
}<BR>
}<BR>
xml_parser_free($parser);<BR> return
true;<BR> }<BR> return
false;<BR>}</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2><BR>function new_xml_parser($file)
{<BR> global $parser_file;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> $xml_parser =
xml_parser_create();<BR> xml_parser_set_option($xml_parser,
XML_OPTION_CASE_FOLDING, 1);<BR>
xml_set_element_handler($xml_parser, "startElement",
"endElement");<BR> xml_set_character_data_handler($xml_parser,
"characterData");<BR>
xml_set_processing_instruction_handler($xml_parser,
"PIHandler");<BR> xml_set_default_handler($xml_parser,
"defaultHandler");<BR>
xml_set_external_entity_ref_handler($xml_parser,
"externalEntityRefHandler");<BR> <BR> if
(!($fp = @fopen($file, "r"))) {<BR>
return false;<BR> }<BR> if
(!is_array($parser_file)) {<BR>
settype($parser_file, "array");<BR> }<BR>
$parser_file[$xml_parser] = $file;<BR> return
array($xml_parser, $fp);<BR>}</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>if (!(list($xml_parser, $fp) =
new_xml_parser($file))) {<BR> die("could not open XML
input");<BR>}</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>print "<pre>";<BR>while ($data = fread($fp,
4096)) {<BR> if (!xml_parse($xml_parser, $data, feof($fp)))
{<BR> die(sprintf("XML error: %s at
line
%d\n",<BR>
xml_error_string(xml_get_error_code($xml_parser)),<BR>
xml_get_current_line_number($xml_parser)));<BR>
}<BR>}<BR>print "</pre>";<BR>print "parse
complete\n";<BR>xml_parser_free($xml_parser);</FONT></DIV>
<DIV><FONT face=Arial size=2>echo connection_status();<BR>echo
fread($fp,128);<BR>?><BR></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>(File c.xml)</FONT></DIV>
<DIV><FONT face=Arial size=2><?xml
version='1.0'?><BR><streams></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2><stream:stream to = "jabber.org" xmlns =
"jabber:client"</FONT></DIV>
<DIV><FONT face=Arial size=2>xmlns:stream = <A
href="http://etherx.jabber.org/streams/">"http://etherx.jabber.org/streams/</A></FONT>"></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2><iq type="get" id="100111"<BR>
to="users.jabber.org"><BR> <A
href='mailto:from="apawaskar@jabber.org/winjab"'>from="apawaskar@jabber.org/winjab"</A>><BR>
<query xmlns="jabber:iq:search"/><BR></iq></FONT></DIV>
<DIV><FONT face=Arial size=2><BR></FONT><FONT face=Arial size=2><message to =
"<A href="mailto:rishi@jabber.org">rishi@jabber.org</A>"
type="chat"><BR><body>This is a test
message</body><BR></message></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2><presence <A
href='mailto:to="rishi@jabber.org'>to="rishi@jabber.org</A>" <BR> <A
href='mailto:from="apawaskar@jabber.org'>from="apawaskar@jabber.org</A>"<BR> type="subscribe"/>
</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></streams></DIV></FONT></BODY></HTML>