尝试连接到xmpp ejabberd服务器时出现php ssl错误

时间:2017-09-05 08:27:26

标签: php ssl xmpp ejabberd

我尝试使用php使用此库连接到我的xmpp服务器:https://github.com/fabiang/xmpp但是出现以下错误:

error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /var/www/html/cobaxmpp/vendor/fabiang/xmpp/src/Stream/SocketClient.php on line 210

这是我的代码

<?php

    $logger = new Logger('xmpp');
    $logger->pushHandler(new StreamHandler('php://stdout', Logger::DEBUG));
    $hostname       = 'im2.hprasetyou.com';
    $port           = 5222;
    $connectionType = 'tcp';
    $address        = "$connectionType://$hostname:$port";
    $username = 'tom';
    $password = 'password';
    $options = new Options($address);
    $options->setLogger($logger)
        ->setUsername($username)
        ->setPassword($password);
    $client = new Client($options);
    $client->connect();
    $client->send(new Roster);
    $client->send(new Presence);
    $client->send(new Message);
    $client->disconnect();

我错过了什么?

0 个答案:

没有答案