2013-04-05 48 views
1

我使用jaxl.V3连接到Facebook。这是我的代码:JAXL例外:此流不支持SSL /加密

<?php 

    require_once '../jaxl.php'; 
    $client = new JAXL(array(
    'jid' => '(myID)'.'@chat.facebook.com', 
    'fb_app_key' => '(MYKeyApp)', 
    'fb_access_token' => '(myAccessToken)', 
    'domain'=>'chat.facebook.com', 
    'host' => 'chat.facebook.com', 
    'port'=>5222, 
    'boshHost'=>'localhost', 
    'priv_dir' => 'D:/wamp/www/jaxl/.jaxl/tmp', 
    'resource' => 'resource', 
    'force_tls' => true, 
    'auth_type' => 'X-FACEBOOK-PLATFORM', 
    'log_level' => JAXL_DEBUG, 
    )); 

    $client->add_cb('on_auth_success', function() { 
     global $client; 
     _info("got on_auth_success cb, jid ".$client->full_jid->to_string()); 
     $client->set_status("Available!", "ol", 10); 
     $msg = new XMPPMsg(array('to'=>'-(myFriID)@chat.facebook.com'), $txtMessage); 
      $client->send($msg); 
    }); 


    $client->add_cb('on_auth_failure', function($reason) { 
     global $client; 
     $client->send_end_stream(); 
     _info("got on_auth_failure cb with reason $reason"); 

    }); 


    $client->add_cb('on_chat_message', function($stanza) { 
     global $client; 

     // echo back incoming message stanza 
     $stanza->to = $stanza->from; 
     $stanza->from = $client->full_jid->to_string(); 
     $client->send($stanza); 
     _info("echo message sent"); 

      sendMessage($client); 
    }); 

    $client->add_cb('on_disconnect', function() { 
     _info("got on_disconnect cb"); 
    }); 

    // 
    // finally start configured xmpp stream 
    // 
    $client->start(); 
    echo "done\n"; 
    ?> 

我已经成功通过使用控制台命令行发送消息聊天。但我需要的是通过浏览器。

jaxl_fsm:56 - 2013-04-05 23:00:57 - calling state handler 'setup' for incoming event 'connect' 
jaxl_socket_client:91 - 2013-04-05 23:00:57 - trying tcp://chat.facebook.com:5222 
jaxl_socket_client:96 - 2013-04-05 23:00:57 - connected to tcp://chat.facebook.com:5222 
jaxl_loop:82 - 2013-04-05 23:00:57 - active read fds: 1, write fds: 0 
jaxl_fsm:65 - 2013-04-05 23:00:57 - current state 'connected' 
jaxl_fsm:56 - 2013-04-05 23:00:57 - calling state handler 'connected' for incoming event 'start_stream' 
jaxl_loop:82 - 2013-04-05 23:00:57 - active read fds: 1, write fds: 1 
jaxl_fsm:65 - 2013-04-05 23:00:57 - current state 'wait_for_stream_start' 
jaxl_socket_client:187 - 2013-04-05 23:00:57 - sent 226/226 of data 
jaxl_socket_client:188 - 2013-04-05 23:00:57 - <stream:stream xmlns:stream="http://etherx.jabber.org/streams" version="1.0" from="[email protected]" to="chat.facebook.com" xmlns="jabber:client" xml:lang="en" xmlns:xml="http://www.w3.org/XML/1998/namespace"> 
jaxl_loop:100 - 2013-04-05 23:00:57 - active read fds: 1, write fds: 0 
jaxl_socket_client:174 - 2013-04-05 23:00:57 - read 173/173 of data 
jaxl_socket_client:175 - 2013-04-05 23:00:57 - <?xml version="1.0"?><stream:stream id="E21DE38D" from="chat.facebook.com" version="1.0" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" xml:lang="en"> 
jaxl_fsm:56 - 2013-04-05 23:00:57 - calling state handler 'wait_for_stream_start' for incoming event 'start_cb' 
jaxl_fsm:65 - 2013-04-05 23:00:57 - current state 'wait_for_stream_features' 
jaxl_socket_client:174 - 2013-04-05 23:00:57 - read 227/400 of data 
jaxl_socket_client:175 - 2013-04-05 23:00:57 - <stream:features><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>X-FACEBOOK-PLATFORM</mechanism><mechanism>DIGEST-MD5</mechanism></mechanisms></stream:features> 
jaxl_fsm:56 - 2013-04-05 23:00:57 - calling state handler 'wait_for_stream_features' for incoming event 'stanza_cb' 
jaxl_loop:82 - 2013-04-05 23:00:57 - active read fds: 1, write fds: 1 
jaxl_fsm:65 - 2013-04-05 23:00:57 - current state 'wait_for_tls_result' 
jaxl_socket_client:187 - 2013-04-05 23:00:57 - sent 61/287 of data 
jaxl_socket_client:188 - 2013-04-05 23:00:57 - <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"></starttls> 
jaxl_loop:100 - 2013-04-05 23:00:57 - active read fds: 1, write fds: 0 
jaxl_socket_client:174 - 2013-04-05 23:00:58 - read 50/450 of data 
jaxl_socket_client:175 - 2013-04-05 23:00:58 - <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls"/> 
jaxl_fsm:56 - 2013-04-05 23:00:58 - calling state handler 'wait_for_tls_result' for incoming event 'stanza_cb' 
jaxl_exception:48 - 2013-04-05 23:00:58 - got jaxl exception construct with stream_socket_enable_crypto() [<a href='streams.crypto'>streams.crypto</a>]: this stream does not support SSL/crypto, 2, D:\wamp\www\jaxl\core\jaxl_socket_client.php, 127 
jaxl_exception:75 - 2013-04-05 23:00:58 - exception handler catched {"xdebug_message":"<tr><th align='left' bgcolor='#f57900' colspan=\"5\"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>(!)<\/span> JAXLException: stream_socket_enable_crypto() [<a href='streams.crypto'>streams.crypto<\/a>]: this stream does not support SSL\/crypto in D:\\wamp\\www\\jaxl\\core\\jaxl_socket_client.php on line <i>127<\/i><\/th><\/tr>\n<tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack<\/th><\/tr>\n<tr><th align='center' bgcolor='#eeeeec'>#<\/th><th align='left' bgcolor='#eeeeec'>Time<\/th><th align='left' bgcolor='#eeeeec'>Memory<\/th><th align='left' bgcolor='#eeeeec'>Function<\/th><th align='left' bgcolor='#eeeeec'>Location<\/th><\/tr>\n<tr><td bgcolor='#eeeeec' align='center'>1<\/td><td bgcolor='#eeeeec' align='center'>0.0005<\/td><td bgcolor='#eeeeec' align='right'>396352<\/td><td bgcolor='#eeeeec'>{main}()<\/td><td title='D:\\wamp\\www\\jaxl\\examples\\xfacebook_platform_client.php' bgcolor='#eeeeec'>..\\xfacebook_platform_client.php<b>:<\/b>0<\/td><\/tr>\n<tr><td bgcolor='#eeeeec' align='center'>2<\/td><td bgcolor='#eeeeec' align='center'>0.0211<\/td><td bgcolor='#eeeeec' align='right'>1553464<\/td><td bgcolor='#eeeeec'>JAXL->start()<\/td><td title='D:\\wamp\\www\\jaxl\\examples\\xfacebook_platform_client.php' bgcolor='#eeeeec'>..\\xfacebook_platform_client.php<b>:<\/b>71<\/td><\/tr>\n<tr><td bgcolor='#eeeeec' align='center'>3<\/td><td bgcolor='#eeeeec' align='center'>0.5094<\/td><td bgcolor='#eeeeec' align='right'>1556144<\/td><td bgcolor='#eeeeec'>JAXLLoop::run()<\/td><td title='D:\\wamp\\www\\jaxl\\jaxl.php' bgcolor='#eeeeec'>..\\jaxl.php<b>:<\/b>386<\/td><\/tr>\n<tr><td bgcolor='#eeeeec' align='center'>4<\/td><td bgcolor='#eeeeec' align='center'>0.9847<\/td><td bgcolor='#eeeeec' align='right'>1570632<\/td><td bgcolor='#eeeeec'>JAXLLoop::select()<\/td><td title='D:\\wamp\\www\\jaxl\\core\\jaxl_loop.php' bgcolor='#eeeeec'>..\\jaxl_loop.php<b>:<\/b>109<\/td><\/tr>\n<tr><td bgcolor='#eeeeec' align='center'>5<\/td><td bgcolor='#eeeeec' align='center'>0.9883<\/td><td bgcolor='#eeeeec' align='right'>1571360<\/td><td bgcolor='#eeeeec'><a href='http:\/\/www.php.net\/call_user_func' target='_new'>call_user_func<\/a>\n()<\/td><td title='D:\\wamp\\www\\jaxl\\core\\jaxl_loop.php' bgcolor='#eeeeec'>..\\jaxl_loop.php<b>:<\/b>133<\/td><\/tr>\n<tr><td bgcolor='#eeeeec' align='center'>6<\/td><td bgcolor='#eeeeec' align='center'>0.9883<\/td><td bgcolor='#eeeeec' align='right'>1571376<\/td><td bgcolor='#eeeeec'>JAXLSocketClient->on_read_ready()<\/td><td title='D:\\wamp\\www\\jaxl\\core\\jaxl_loop.php' bgcolor='#eeeeec'>..\\jaxl_loop.php<b>:<\/b>133<\/td><\/tr>\n<tr><td bgcolor='#eeeeec' align='center'>7<\/td><td bgcolor='#eeeeec' align='center'>0.9915<\/td><td bgcolor='#eeeeec' align='right'>1572888<\/td><td bgcolor='#eeeeec'><a href='http:\/\/www.php.net\/call_user_func' target='_new'>call_user_func<\/a>\n()<\/td><td title='D:\\wamp\\www\\jaxl\\core\\jaxl_socket_client.php' bgcolor='#eeeeec'>..\\jaxl_socket_client.php<b>:<\/b>178<\/td><\/tr>\n<tr><td bgcolor='#eeeeec' align='center'>8<\/td><td bgcolor='#eeeeec' align='center'>0.9915<\/td><td bgcolor='#eeeeec' align='right'>1572936<\/td><td bgcolor='#eeeeec'>JAXLXmlStream->parse()<\/td><td title='D:\\wamp\\www\\jaxl\\core\\jaxl_socket_client.php' bgcolor='#eeeeec'>..\\jaxl_socket_client.php<b>:<\/b>178<\/td><\/tr>\n<tr><td bgcolor='#eeeeec' align='center'>9<\/td><td bgcolor='#eeeeec' align='center'>0.9916<\/td><td bgcolor='#eeeeec' align='right'>1573000<\/td><td bgcolor='#eeeeec'><a href='http:\/\/www.php.net\/xml_parse' target='_new'>xml_parse<\/a>\n()<\/td><td title='D:\\wamp\\www\\jaxl\\core\\jaxl_xml_stream.php' bgcolor='#eeeeec'>..\\jaxl_xml_stream.php<b>:<\/b>92<\/td><\/tr>\n<tr><td bgcolor='#eeeeec' align='center'>10<\/td><td bgcolor='#eeeeec' align='center'>0.9916<\/td><td bgcolor='#eeeeec' align='right'>1573960<\/td><td bgcolor='#eeeeec'>JAXLXmlStream->handle_end_tag()<\/td><td title='D:\\wamp\\www\\jaxl\\core\\jaxl_xml_stream.php' bgcolor='#eeeeec'>..\\jaxl_xml_stream.php<b>:<\/b>92<\/td><\/tr>\n<tr><td bgcolor='#eeeeec' align='center'>11<\/td><td bgcolor='#eeeeec' align='center'>0.9917<\/td><td bgcolor='#eeeeec' align='right'>1574328<\/td><td bgcolor='#eeeeec'><a href='http:\/\/www.php.net\/call_user_func' target='_new'>call_user_func<\/a>\n()<\/td><td title='D:\\wamp\\www\\jaxl\\core\\jaxl_xml_stream.php' bgcolor='#eeeeec'>..\\jaxl_xml_stream.php<b>:<\/b>163<\/td><\/tr>\n<tr><td bgcolor='#eeeeec' align='center'>12<\/td><td bgcolor='#eeeeec' align='center'>0.9917<\/td><td bgcolor='#eeeeec' align='right'>1574720<\/td><td bgcolor='#eeeeec'>JAXLFsm->__call()<\/td><td title='D:\\wamp\\www\\jaxl\\core\\jaxl_xml_stream.php' bgcolor='#eeeeec'>..\\jaxl_xml_stream.php<b>:<\/b>0<\/td><\/tr>\n<tr><td bgcolor='#eeeeec' align='center'>13<\/td><td bgcolor='#eeeeec' align='center'>0.9932<\/td><td bgcolor='#eeeeec' align='right'>1576088<\/td><td bgcolor='#eeeeec'><a href='http:\/\/www.php.net\/call_user_func' target='_new'>call_user_func<\/a>\n()<\/td><td title='D:\\wamp\\www\\jaxl\\core\\jaxl_fsm.php' bgcolor='#eeeeec'>..\\jaxl_fsm.php<b>:<\/b>58<\/td><\/tr>\n<tr><td bgcolor='#eeeeec' align='center'>14<\/td><td bgcolor='#eeeeec' align='center'>0.9933<\/td><td bgcolor='#eeeeec' align='right'>1576136<\/td><td bgcolor='#eeeeec'>XMPPStream->wait_for_tls_result()<\/td><td title='D:\\wamp\\www\\jaxl\\core\\jaxl_fsm.php' bgcolor='#eeeeec'>..\\jaxl_fsm.php<b>:<\/b>58<\/td><\/tr>\n<tr><td bgcolor='#eeeeec' align='center'>15<\/td><td bgcolor='#eeeeec' align='center'>0.9933<\/td><td bgcolor='#eeeeec' align='right'>1576136<\/td><td bgcolor='#eeeeec'>JAXLSocketClient->crypt()<\/td><td title='D:\\wamp\\www\\jaxl\\xmpp\\xmpp_stream.php' bgcolor='#eeeeec'>..\\xmpp_stream.php<b>:<\/b>483<\/td><\/tr>\n<tr><td bgcolor='#eeeeec' align='center'>16<\/td><td bgcolor='#eeeeec' align='center'>0.9933<\/td><td bgcolor='#eeeeec' align='right'>1576232<\/td><td bgcolor='#eeeeec'><a href='http:\/\/www.php.net\/stream_socket_enable_crypto' target='_new'>stream_socket_enable_crypto<\/a>\n()<\/td><td title='D:\\wamp\\www\\jaxl\\core\\jaxl_socket_client.php' bgcolor='#eeeeec'>..\\jaxl_socket_client.php<b>:<\/b>127<\/td><\/tr>\n<tr><td bgcolor='#eeeeec' align='center'>17<\/td><td bgcolor='#eeeeec' align='center'>0.9933<\/td><td bgcolor='#eeeeec' align='right'>1577176<\/td><td bgcolor='#eeeeec'>JAXLException::error_handler()<\/td><td title='D:\\wamp\\www\\jaxl\\core\\jaxl_socket_client.php' bgcolor='#eeeeec'>..\\jaxl_socket_client.php<b>:<\/b>127<\/td><\/tr>\n"} 
jaxl:228 - 2013-04-05 23:00:58 - cleaning up pid and unix sock files 
jaxl_clock:55 - 2013-04-05 23:00:58 - shutting down clock server... 

,我在php.ini文件中激活已经延伸= php_openssl.dll:相同的代码的配置,如果我通过浏览器来运行它,我喜欢在日志文件中有错误讯息。 PLZ帮我解决它。任何想法请.. 我很快寻找你的帮助。谢谢

+0

如果不能看到有问题的代码,就很难帮助解决问题。 – Jon 2013-04-05 09:44:19

+0

是的,对!所以你需要我展示一些代码,@ Jon?没关系,但我只是想知道它是相同的代码,它在控制台中运行良好,但是当我通过浏览器运行时显示这个错误。 :( – 2013-04-05 09:54:10

+0

这就是为什么我们需要查看代码 - 查看在浏览器中可能导致它失败的原因(也可以从控制台中将它在与浏览器相同的位置运行)? – Jon 2013-04-05 09:56:29

回答

3

如果有人使用Jaxl库和我遇到同样的问题。你只需要安装OpenSSL this

窗口。一切都有问题,SSL不支持将可以解决。另一个,如果你尝试在JAXL库作为我我建议你测试与http_bind

它可能比我现在正在尝试更容易。 :D