Recently, the video of sending good morning greetings to female friends on TikTok has become quite popular. As a cousin, you should set an example. It is my unshirkable responsibility to enable your girlfriend to receive good morning greetings through simple configurations.
Configuration
First visit the following connection and use your WeChat to scan the QR code to authorize login! https://mp.weixin.qq.com/debug/cgi-bin/sandbox?t=sandbox/login
Record the obtained app ID and appsecret value!
Then flip down and add a new test template.
Add template title and template content
{{first.DATA}}
Today's weather: {{keyword1.DATA}}
Today's temperature: {{keyword2.DATA}}
We are already in love: {{keyword3.DATA}}
There is still {{keyword4.DATA}}
{{remark.DATA}}
After the addition is complete, record the template ID
Then ask your girlfriend to follow the test official account, get the WeChat account and record it.
Get the weather interface
Visit the following link http://www.tianqiapi.com/
Register and log in, get the appid and appsecret and record, and test the weather information of the local city.
The API interface is as follows:
https://www.yiketianqi.com/free/day?appid=your idappsecret=your value unescape=1city=%E5%85%B0%E5%B7%9E
Get sweet talk interface
Visit www.alapi.cn, register and log in. Get the token and record it.
The API interface is as follows:
https://v2.alapi.cn/api/qinghua?token=Your value
Configure PHP
?php
$appId='1'; //Comply your own appId
$appSecret='2'; //Comply with your own appSecret
$wxgzhurl='https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credentialappid=' . $appId . 'secret=' . $appSecret;
$access_token_Arr=https_request($wxgzhurl);
$access_token=json_decode($access_token_Arr, true);
$ACCESS_TOKEN=$access_token['access_token']; //ACCESS_TOKEN
//When will you fall in love (don't make the format wrong)
$lovestart=strtotime('2022-08-01');
$end=time();
$love=ceil(($end - $lovestart)/86400);
//Which day is the next birthday (don't make the wrong format)
$birthdaystart=strtotime('2023-01-25');
$end=time();
$diff_days=($birthdaystart - $end);
$birthday=(int)($diff_days/86400);
$birthday=str_replace('-', '', $birthday);
$tianqiurl='https://www.yiketianqi.com/free/day?appid=95943915appsecret=5KNSKu9yunescape=1city=Wuhan'; //Modify it to your own
$tianqiapi=https_request($tianqiurl);
$tianqi=json_decode($tianqiapi, true);
$qinghuaqiurl='https://v2.alapi.cn/api/qinghua?token=BFlSa9Ny7qTZHwYk'; //Modify it to your own
$qinghuaapi=https_request($qinghuaqiurl);
$qinghua=json_decode($qinghuaapi, true);
//A word from you
$yjh=''; //You can leave it blank or write a previous sentence
$touser='oOBhas1F-h6rP9DxsTZGCP7xgjeQ'; //Fill in your girlfriend's openid
$data=array(
'touser'=$touser,
'template_id'='ujSRYGrQep4A8o0JCyW4pdy5cZ0YXrT6QXwMZC5tAf1111111111111110', //Change it to your own template id and view it in the WeChat background template message
'data'=array(
'first'=array(
'value'='$yjh',
'color'='#000'
),
'keyword1'=array(
'value'=$tianqi['wea'],
'color'='#000'
),
'keyword2'=array(
'value'=$tianqi['tem_day'],
'color'='#000'
),
'keyword3'=array(
'value'=$love . 'day',
'color'='#000'
),
'keyword4'=array(
'value'=$birthday . 'day',
'color'='#000'
),
'remark'=array(
'value'=$qinghua['data']['content'],
'color'='#f00'
),
)
);
//There is no need to move the following ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
$json_data=json_encode($data);
$url='https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=' . $ACCESS_TOKEN;
$res=https_request($url, urldecode($json_data));
$res=json_decode($res, true);
if ($res['errcode']==0 $res['errcode']=='ok') {
echo 'Send successfully! br/';
}else {
echo 'Send failed! Please check the code! br/';
}
function https_request($url, $data=null)
{
$curl=curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
if (!empty($data)) {
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
}
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$output=curl_exec($curl);
curl_close($curl);
return $output;
}
After modifying the php file, upload it to the local server or remote server to test the link! If the prompt is sent successfully, the configuration will be completed!
Add a timed task
If you want your girlfriend to wake up in the morning, the first message you receive is a greeting from you. You must set up a scheduled task.
The command is as follows:
00 08 * * * /usr/bin/curl https://bbskali.cn/love.php that is 8:00 visits every day https://bbskali.cn/love.php
This is done, and your daily care for your girlfriend!
Effect
Recommended Comments