gpt4 book ai didi

php - 将消息从网络服务器发送到我智能手机上的移动聊天应用程序(如 WhatsApp、Viber 或 Kik)?

转载 作者:塔克拉玛干 更新时间:2023-11-03 05:38:50 24 4
gpt4 key购买 nike

我想从我的网络服务器向我的智能手机发送通知,最好是通过 WhatsApp、Viber 或 Kik 等流行的移动聊天应用之一。

是否有任何已知的文档或 API 或其他东西描述如何向这些客户端发送消息,例如使用 PHP?

请注意,我只需要能够向我自己的智能手机发送通知,因此需要特定信息来识别我的特定客户(例如手机号码或其他信息)就可以了。

最佳答案

有许多网络服务可让您发送和接收短信/通知。 PHP 本身不支持它自己。您可以使用 Twilio 之类的服务来执行此操作。您可以将消息发送到您自己的智能手机,甚至是 friend 的智能手机。

example :

<?php

require "Services/Twilio.php";

// Step 2: set our AccountSid and AuthToken from www.twilio.com/user/account
$AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$AuthToken = "YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY";

// Step 3: instantiate a new Twilio Rest Client
$client = new Services_Twilio($AccountSid, $AuthToken);

// Step 4: make an array of people we know, to send them a message.
// Feel free to change/add your own phone number and name here.
$people = array(
"+14158675309" => "Curious George",
"+14158675310" => "Boots",
"+14158675311" => "Virgil",
);

// Step 5: Loop over all our friends. $number is a phone number above, and
// $name is the name next to it
foreach ($people as $number => $name) {

$sms = $client->account->sms_messages->create(

// Step 6: Change the 'From' number below to be a valid Twilio number
// that you've purchased, or the (deprecated) Sandbox number
"YYY-YYY-YYYY",

// the number we are sending to - Any phone number
$number,

// the sms body
"Hey $name, Monkey Party at 6PM. Bring Bananas!"
);

// Display a confirmation message on the screen
echo "Sent message to $name";
}

参见文档 here .

希望这对您有所帮助!

关于php - 将消息从网络服务器发送到我智能手机上的移动聊天应用程序(如 WhatsApp、Viber 或 Kik)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17909605/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com