Home  >  Article  >  Backend Development  >  php Aurora Push (Push-API-v3)

php Aurora Push (Push-API-v3)

WBOY
WBOYOriginal
2016-07-25 08:47:361222browse
php Aurora Push (Push-API-v3)
                 
                                                                                                                                                                                                                                                                                                                     


error_reporting(E_ALL^E_NOTICE);
class ApipostAction{
  1. private $_appkeys = 'f722b1337ded8********';
  2. private $_masterSecret = 'bd267a37c3034fd6*******';
  3.          function request_post($url="",$param="",$header="") {
  4.                                                                                                                                        $postUrl = $url;​ ​ ​ curl_setopt($ch, CURLOPT_HEADER, 0) ;//Set header
  5.                 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//Require the result to be a string and output it to the screen
  6.                   curl_setopt($ch, CURLOPT_POST, 1); //Post submission method
  7.            curl_setopt($ch, Curlopt_postfields, $ CurlPost);
  8. CURL_SETOPT ($ CH, Curlopt_httpheader, $ Header);
  9. // Fields in HTTP Header (head) _SSL_verifypeer, FALSE);
  10.             curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
  11.                                                                                                         using   with curl using using  -                                    
  12.                                                                                                                                                                                  """""" )
  13.                                              $url = 'https://api.jpush.cn/v3/push';                $header= array("Authorization:Basic $base64","Content-Type:application/json");
  14.                                   // print_r($header);                                   $param='{"platform":"all","audience":"all ","notification" : {"alert" : "Hi,JPush!"},"message":{"msg_content":"'.$message.'","title":"'.$title.'"} }';
  15.                               $res = $this->request_post($url,$param,$header);
  16.        }
  17. }
  18. $ jpush=new ApipostAction();
  19. $jpush->send('this title','this mesage');
  20. Copy code
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn