Ask about Baidu Cloud push the problem (urgent)

Source: Internet
Author: User
Tags fread
Recently in the Baidu cloud push interface problem, there are some problems
The code is as follows:
Push iOS device message function Test_pushmessage_ios ($user _id, $channel _id, $title, $badge, $receivemobile, $caseid, $msgid) {        $appid = $this->appid;        $apiKey = $this->apikey;         $secretKey = $this->secretkey;        $this->initpush ();                $channel = new Channel ($apiKey, $secretKey); /* $push _type * 1: Single person, must specify USER_ID and channel_id (specified user on the specified device) or user_id (all devices of the specified user) * 2: A group of people, must specify the tag_name * 3: everyone, without Specify Tag_name, USER_ID, channel_id */$push _type = 1; Push unicast message $optional [channel::user_id] = $user _id; If you push a unicast message, you need to specify the user//$optional [channel::channel_id] = $channel _id; If you push a unicast message, you need to specify the user $optional [Channel::D Evice_type] = 4;//to assign to the iOS device $optional [Channel::message_type] = 1;     Specifies the message type for the notification//if the iOS app current deployment status is development state, the specified deploy_status is 1, the default is the production status, and the value is 2.        Older versions used different domain names to differentiate the deployment state and still support it.        $optional [Channel::D eploy_status] = 2;  The content of the notification type must be sent by the specified content, as shown in the following example: $message = ' {              "APS": {"alert": "'. $title. '", "Sound": "", "badge": '. $badge. '                        }, "Receivemobile": "'. $receivemobile. '",                                                                  "Caseid": "'. $caseid. '", "MsgId": "'. $msgid. '"        }';        $message _key = "Msg_key";        $ret = $channel->pushmessage ($push _type, $message, $message _key, $optional);        return $ret; if (false = = = $ret) {$this->error_output (' wrong, '. __function__. ' ERROR!!!!! ')            ;            $this->error_output (' Error number: ' $channel->errno ());            $this->error_output (' Error MESSAGE: ' $channel->errmsg ());        $this->error_output (' REQUEST ID: '. $channel->getrequestid ()); } else {$this->right_output (' SUCC, '. __function__. ' ok!!!!!' )            ;        $this->right_output (' Result: '. Print_r ($ret, true)); }

1, before the development state, unicast message push has been normal, there is no problem, but switch to production status, push has failed;
2, consulted some people, said that the need to initialize the certificate, so in $channel = new channel ($apiKey, $secretKey), and then joined the formal initialization of the program (the following program), push unicast messages or failed; But here's a question. I switched to the development state, unicast also failed, only the group push can be successful;
3, in the Baidu Management console, the original group push can also receive the message, now in the management console is not a development state or production status, group push will not receive messages.

Please help me check and see where the problem appears.

$devcert = "/opt/lampp/htdocs/baidu/messagecent.pem";        $discert = "/opt/lampp/htdocs/baidu/messagecent2.pem";                $cert _name= "Test";        $cert _des= "Test";        $cert _name= "Test";        $cert _des= "Test";                                $FD = fopen ($devcert, ' R ');        $devcert = Fread ($FD, FileSize ($devcert)); Development version of APNs PEM certificate                $fd = fopen ($discert, ' R ');        $discert = Fread ($FD, FileSize ($discert)); Release version APNs PEM certificate        //print_r ($discert);                $ret = $channel->initappioscert ($cert _name, $cert _des, $discert, $devcert); Cert_name and cert_des You can customize the string to


Reply to discussion (solution)

Push unicast messages under production, prompting
[1;40;32MSUCC, Test_pushmessage_ios OK!!!!! [0m [1;40;32mresult:array ([request_id] = 2197319330 [Response_params] = = Array ([success_amount] = 0 [MsgId s] = = Array ())) [0m
If the production mode, group push, prompt
[1;40;32MSUCC, Test_pushmessage_ios OK!!!!! [0m [1;40;32mresult:array ([request_id] = 2196426378 [Response_params] = = Array ([success_amount] = 1 [Resou Rce_ids] = Array ([0] = msgid#5305396010453184756))) [0m

Did the landlord solve it? Tell me, thank you!

  • 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.