The Ring letter server registers the client account

Source: Internet
Author: User
Tags curl mixed

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);
 }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.