function pushme($params = array()) { $options = array('http' => array( 'method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => http_build_query($params) ) ); return $result = file_get_contents('https://push.i-i.me/', 0, stream_context_create($options)); } //example $res = pushme(['push_key' => 'your push_key', 'title' => 'hello', 'content' => 'this is message content']); echo $res;
function pushme($params = []) { $url = 'https://push.i-i.me/'; $data = json_encode($params, JSON_UNESCAPED_UNICODE); $len = strlen($data); $curl = curl_init(); // 启动一个CURL会话 curl_setopt($curl, CURLOPT_URL, $url); // 要访问的地址 curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检测 curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); // 从证书中检查SSL加密算法是否存在 curl_setopt($curl, CURLOPT_POST, 1); // 发送一个常规的Post请求 curl_setopt($curl, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json; charset=utf-8', 'Content-Length: ' . $len) ); curl_setopt($curl, CURLOPT_POSTFIELDS, $data); // Post提交的数据包 curl_setopt($curl, CURLOPT_TIMEOUT, 30); // 设置超时限制防止死循 curl_setopt($curl, CURLOPT_HEADER, 0); // 显示返回的Header区域内容 curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回 $tmpInfo = curl_exec($curl); // 执行操作 if (curl_errno($curl)) { return curl_errno($curl).': '.curl_error($curl); } curl_close($curl); // 关键CURL会话 return $tmpInfo; // 返回数据 } //example $res = pushme(['push_key' => 'your push_key', 'title' => 'hello', 'content' => 'this is message content']); echo $res;
async function pushme(params) { const https = require('https'); const data = Buffer.from(JSON.stringify({...params})); const options = { hostname: 'push.i-i.me', path: '/', method: 'POST', headers: { 'Content-Type': 'application/json', 'Content-Length': data.length } } return new Promise((resolve) => { const req = https.request(options, res => { let _data = ''; res.on('data', chunk => { _data += chunk; }); res.on('end', _ => { resolve(_data.toString()); }); }); req.on('error', error => { resolve(error.toString()) }); req.write(data); req.end(); }); } //example pushme({push_key: 'your push_key', title: 'test'}).then(res => console.log(res));
# -*- coding: utf-8 import requests url = "https://push.i-i.me" payload = { 'push_key': 'push_key', 'title': 'title', 'content': 'content', 'type': 'text', 'date': 'date' } headers = { 'accept': '*/*', 'accept-encoding': 'gzip', 'accept-language': 'zh-CN,zh;q=0.9', 'content-type': 'application/x-www-form-urlencoded; charset=UTF-8', 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.6045.160 Safari/537.36' } response = requests.post(url, headers = headers, data = payload) print(response.text)