Register customer Interaction Cloud Account: Create mobile App
Ring Letter Developer Center:
Appkey's # is org_name before, #号后是app_name
Where document address: http://api-docs.easemob.com/#/
Get token:
protected $url = ' http://a1-vip5.easemob.com/1401180313068864/kefuchannelapp53097/token/'; /** * Get token * Org_name Enterprise Administrator name * APP_NAME Application name/Public function token () {$data =
Array (' Grant_type ' => ' client_credentials ', ' client_id ' => ' YXA66T3OWCADEEIPP_ELVHKZPG ',
' Client_secret ' => ' yxa6njmadgb_qtqay-9rdpdwucyvxgg ',);
$rs = $this->curlhttppostjsonrequest ($data);
$this->res_data[' data '] = $rs;
$this->apireply (); /** * Curl Simulate HTTP request * @param $data * @return Mixed/Public function curlhttppostjsonrequ
EST ($data) {$crl = Curl_init ();
$data = Json_encode ($data);
curl_setopt ($CRL, Curlopt_url, $this->url);
curl_setopt ($CRL, Curlopt_customrequest, "POST");
curl_setopt ($CRL, Curlopt_returntransfer, 1);
curl_setopt ($CRL, Curlopt_post, 1); curl_setopt ($CRL, Curlopt_postfields, $DATA); curl_setopt ($CRL, Curlopt_httpheader, Array (' Content-type:application/json ', ' Content-le Ngth: '.
Strlen ($data)));
$output = curl_exec ($CRL);
Curl_close ($CRL);
Return Json_decode ($output); }
User registration:
protected $url = ' http://a1-vip5.easemob.com/1401180313068864/kefuchannelapp53097/users '; /** * Registered User * Org_name * app_name * users [{' username ': ' string ', ' Password ': ' String '}] */Publi
C function Register () {$data = Array (' username ' => ' heiye5201 ', ' Password ' => ' 123456 '),
);
$rs = $this->curlhttppostjsonrequest ($data);
$this->res_data[' data '] = $rs;
$this->apireply (); /** * Curl Simulate HTTP request * @param $data * @return Mixed/Public function Curlhttppostjsonreque
St ($data) {$crl = Curl_init ();
$data = Json_encode ($data);
curl_setopt ($CRL, Curlopt_url, $this->url);
curl_setopt ($CRL, Curlopt_customrequest, "POST");
curl_setopt ($CRL, Curlopt_returntransfer, 1);
curl_setopt ($CRL, Curlopt_post, 1);
curl_setopt ($CRL, Curlopt_postfields, $data); curl_setopt ($CRL, Curlopt_httpheader, array(' Content-type:application/json ', ' content-length: '. strlen ($data)));
$output = curl_exec ($CRL);
Curl_close ($CRL);
Return Json_decode ($output);
}