一、以下是 一段 JavaScript – jQuery, 你把这段内容复制到记事本,再存为 .html 文件,然后直接点击运行这个文件就可以了。
以下三行,依次是服务器地址,API密钥,数据表,不能修改:
“url”: “https://www.1000sapp.cn/wp-json/frm/v2/entries/”,
“Authorization”: “Basic Q0tLRS1GV0lGLTFORDUtMUZHQTp4”
form.append(“form_id”, “73”);
以下四行,依次是“高压”,“低压”,“心率”,“体温” 的静态模拟数据,这应当是以后要采集的动态数据,模拟数据(120,70,75,36 )可以改:
form.append(“keg0m”, “120”);
form.append(“qbfx8”, “70”);
form.append(“smw1t”, “75”);
form.append(“al4d2”, “36”);
form.append(“64uw82”, “henrywong800@hotmail.com”); 可以把邮件地址改成自己的,数据就会转发到您的邮箱
平台会动态呈现采集的数据(每日如有多次测量,平台取数据均值),
点点看吧: 数据呈现
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
<body>
<script>
var form = new FormData();
form.append("form_id", "73");
form.append("keg0m", "120");
form.append("qbfx8", "70");
form.append("smw1t", "75");
form.append("al4d2", "36");
form.append("3g90h43", "2020/12/20");
form.append("cavyh", "王老五");
form.append("64uw82", "henrywong800@hotmail.com");
form.append("jzq2a2", "715");
form.append("qbvcy32", "1608433779");
var settings = {
"url": "https://www.1000sapp.cn/wp-json/frm/v2/entries/",
"method": "POST",
"timeout": 0,
"headers": {
"Authorization": "Basic Q0tLRS1GV0lGLTFORDUtMUZHQTp4"
},
"processData": false,
"mimeType": "multipart/form-data",
"contentType": false,
"data": form
};
$.ajax(settings).done(function (response) {
console.log(response);
});
</script>
<h2>数据已经存储到 1000sAPP.com 云服务器</h2>
<p>平台会动态呈现采集的数据(每日如有多次采集,平台取日平均值)</p>
<h2> <a href="https://www.1000sapp.cn/blog/chapter-2-health-management/">数据呈现</a> </h2>
</body>
</html>
二、这是一段 PHP ,如果你那里有PHP的运行环境,复制并直接运行此文件,同样能把数据POST到服务器。如果你没有PHP运行环境,可以点击以下链接,大体感受一下。
https://www.1000sapp.cn/php-curl.php
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://www.1000sapp.cn/wp-json/frm/v2/entries/',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('form_id' => '73','keg0m' => '120','qbfx8' => '70','smw1t' => '75','al4d2' => '36','3g90h43' => '2020/12/20','cavyh' => 'Lao Wang','64uw82' => 'henrywong800@hotmail.com','jzq2a2' => '230','qbvcy32' => '1608404027'),
CURLOPT_HTTPHEADER => array(
'Authorization: Basic Q0tLRS1GV0lGLTFORDUtMUZHQTp4'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>
这是 GET, 暂时放一放。
https://www.1000sapp.cn/php-curl-get.php
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://www.1000sapp.cn/wp-json/frm/v2/forms/73/entries/',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Authorization: Basic Q0tLRS1GV0lGLTFORDUtMUZHQTp4'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>