|
- function send_post($url, $post_data) {
- $postdata = http_build_query($post_data);
- $now = time();
- $jiami = "A6079272802013UZ1FBA2768-5482-6255-1300-E4BC1EB73BC4UZ".$now;
- $jiami = sha1($jiami).".".$now;
- $options = array(
- 'http' => array(
- 'method' => 'POST',
- 'header' => 'Content-type:application/x-www-form-urlencoded',
- 'content' => $postdata,
- 'timeout' => 15 * 60,
- 'X-APICloud-AppId' => "A6079272802013",
- 'X-APICloud-AppKey' => $jiami,
- 'Content-Type' => "application/json"
-
- )
- );
- $context = stream_context_create($options);
- $result = file_get_contents($url, false, $context);
- return $result;
- }
- $post_data = array(
- 'title' => "你好888",
- "content" => "娃哈哈",
- "type" => 2, //– 消息类型,1:消息 2:通知
- "platform" => 2, //0:全部平台,1:ios, 2:android
- "userIds" => "341",
-
- );
- echo send_post('https://p.apicloud.com/api/push/message', $post_data);
复制代码 |
|