JAXL::get_vcard PHP Method

get_vcard() public method

public get_vcard ( $jid = null, $cb = null )
    public function get_vcard($jid = null, $cb = null)
    {
        $attrs = array('type' => 'get', 'from' => $this->full_jid->to_string());
        if ($jid) {
            $jid = new XMPPJid($jid);
            $attrs['to'] = $jid->node . "@" . $jid->domain;
        }
        $pkt = $this->get_iq_pkt($attrs, new JAXLXml('vCard', 'vcard-temp'));
        if ($cb) {
            $this->add_cb('on_stanza_id_' . $pkt->id, $cb);
        }
        $this->send($pkt);
    }

Usage Example

コード例 #1
0
require_once 'jaxl.php';
$client = new JAXL(array('jid' => $argv[1], 'pass' => $argv[2], 'auth_type' => @$argv[3] ? $argv[3] : 'PLAIN', 'log_level' => JAXL_INFO));
//
// required XEP's
//
$client->require_xep(array('0199'));
//
// add necessary event callbacks here
//
$client->add_cb('on_auth_success', function () {
    global $client;
    _info("got on_auth_success cb, jid " . $client->full_jid->to_string());
    // fetch roster list
    $client->get_roster();
    // fetch vcard
    $client->get_vcard();
    // set status
    $client->set_status("available!", "dnd", 10);
});
// by default JAXL instance catches incoming roster list results and updates
// roster list is parsed/cached and an event 'on_roster_update' is emitted
$client->add_cb('on_roster_update', function () {
    //global $client;
    //print_r($client->roster);
});
$client->add_cb('on_auth_failure', function ($reason) {
    global $client;
    _info("got on_auth_failure cb with reason {$reason}");
    $client->send_end_stream();
});
$client->add_cb('on_chat_message', function ($stanza) {
All Usage Examples Of JAXL::get_vcard