• 小果酱QPush消息推送已上线,免费使用~!

小果酱QPush推送DEMO代码

功能介绍 1年前 (2022-01-25) 861次浏览

为了让小伙伴轻松接入,以下准备了小果酱QPush不同开发语言的DEMO。

小果酱支持GET/POST,Content-type: application/x-www-form-urlencodedContent-type: application/json

PHP:

function send($token = ''  ,$title='' , $content = '')
{
    $postdata = http_build_query( array('token'=>$token,'title' => $title, 'content' => $content ));
    $opts = array('http' =>
        array(
            'method'  => 'POST',
            'header'  => 'Content-type: application/x-www-form-urlencoded',
            'content' => $postdata));
    $context  = stream_context_create($opts);
    return file_get_contents('https://s.xiaoguojiang.net/send', false, $context);
}

var_dump(send('xxxxxxxxx','aaa','ssdfsdfsdf'));

Python:

# encoding:utf-8
import requests
token = '你的token' #小果酱QPush中的KEY
title= '标题' #改成你要的标题内容
content ='内容' #改成你要的正文内容
url = 'https://s.xiaoguojiang.net/send?token='+token+'&title='+title+'&content='+content
requests.get(url))

其他如Java,NodeJs等语言demo稍后更新。

 

点击查看更多小果酱QPush信息

立即免费使用
喜欢 (2)