dongqian1893 2015-03-09 04:34
浏览 31

为Quickblox生成会话和QB令牌

I want to implement chat using Quickblox for my website. I need to create user dynamically. I am using following code it returns me signature but for next step to create new user I need token and I am not getting it.

$session_xml_data='<?xml version="1.0" encoding="utf-8"?>
    <response>
    <application_id>'.$application_id.'</application_id>
    <auth_key>'.$auth_key.'</auth_key>
    <timestamp>'.time().'</timestamp>
    <nonce>'.rand(111111,999999).'</nonce>
    <signature>'.$signature.'</signature>
</response>';
$session_xml_data = simplexml_load_string($session_xml_data);
$url ='https://api.quickblox.com/session.json';
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt( $ch, CURLOPT_POST, true );
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml','QuickBlox-REST-API-Version: 0.1.0'));
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_POSTFIELDS, "$session_xml_data" );
$result = curl_exec($ch);
echo '<br /> Token Here';print_r($result);
curl_close($ch);
echo '******** '.$token=$result;
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 目详情-五一模拟赛详情页
    • ¥15 有了解d3和topogram.js库的吗?有偿请教
    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?
    • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
    • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
    • ¥15 cmd cl 0x000007b
    • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line