Ask questions about Baidu Cloud Push (urgent) about the Baidu cloud push interface recently. some problems have occurred.
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: Individual. user_id and channel_id (specified user on the specified device) or user_id (all devices of the specified user) must be specified. * 2: A group of people, must specify tag_name * 3: all people, do not need to specify tag_name, user_id, channel_id */$ Push_type = 1; // push unicast messages $ optional [Channel: USER_ID] = $ user_id; // if a unicast message is pushed, you must specify user // $ optional [Channel: CHANNEL_ID] = $ channel_id; // if you push a unicast message, you must specify user $ optional [Channel: DEVICE_TYPE] = 4; // specify the message sent to the ios device $ optional [Channel: MESSAGE_TYPE] = 1; // specify the message type as notification // if the current deployment status of the ios application is development, set DEPLOY_STATUS to 1. the default value is production status and the value is 2. the old version uses different domain names to differentiate the deployment status and is still supported. $ Optional [Channel: DEPLOY_STATUS] = 2; // The notification content must be sent according to the specified content, for 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 ('wr ONG, '. _ 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. Previously, in the development status, Unicast message push has been normal and has no problem, but failed to switch to the production status;
2. I consulted some people and said they needed to initialize the certificate. Therefore, after $ channel = new Channel ($ apiKey, $ secretKey); then I added the formally initialized program (the following program ), I still failed to push the unicast message. However, a problem occurred here: I switched to the development status and unicast also failed. only group pushing can be successful;
3. in the Baidu console, messages can still be received by group pushing. Currently, in the console, messages are not received in development or production status.
Please help me check and see where the problem occurs.
$ 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 )); // developed APNs pem certificate $ fd = fopen ($ discert, 'r'); $ discert = fread ($ fd, filesize ($ discert )); // publish APNs pem certificate // print_r ($ discert); $ ret = $ channel-> initAppIoscert ($ cert_name, $ cert_des, $ discert, $ devcert ); // cert_name and cert_des: custom string.
Reply to discussion (solution)
Push unicast messages during production, prompting
[1; 40; 32 mSUCC, test_pushMessage_ios OK !!!!! [0 m [1; 40; 32 mresult: array ([request_id] => 2197319330 [response_params] => Array ([success_amount] => 0 [msgids] => Array () [0 m
If group push is performed in production mode, a prompt is displayed.
[1; 40; 32 mSUCC, test_pushMessage_ios OK !!!!! [0 m [1; 40; 32 mresult: array ([request_id] => 2196426378 [response_params] => Array ([success_amount] => 1 [resource_ids] => Array ([0] => msgid #5305396010453184756 ))) [0 m
Has the landlord solved the problem? Let me know. thank you!