网站 HTML 上的 Twilio Whatsapp 联系表

问题描述

您好,我正在尝试制作将信息发送到 whatsapp 的 html 联系表单,但我没有在我的 whatsapp 上收到消息,我将在此处发布代码……以及在我在 Twilio 上打开 whatsapp 沙箱后的另一个问题,我需要在 Twilio WebHook 上再放一个链接??

<?PHP 
 
// Update the path below to your autoload.PHP,// see https://getcomposer.org/doc/01-basic-usage.md 
require_once '/twilio-PHP-main/src/Twilio/autoload.PHP';  
 
use Twilio\Rest\Client; 
$fullname = $_POST['fullname'];
$phone    = $_POST['phone'];
$message  = $_POST['message'];

$sid      = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 
$token    = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 
$twilio   = new Client($sid,$token); 
 
$message = $twilio->messages 
                  ->create("whatsapp:+972506038686",// to 
                           array( 
                               "from" => "whatsapp:+14155238886","body" => "New clinet from website.\n Name: $name \nPhone: $phone \nMessage: $message" 
                           ) 
                  ); 
 
print($message->sid);
?>
<!DOCTYPE html>
<html>
<head>
  <title>Page Title</title>
  <Meta name='viewport' content='width=device-width,initial-scale=1'>
</head>
<body>

  <div class="container">
    <form method="post" action="main.PHP">
  
      <label for="fullname">Full Name</label>
      <input type="text" id="fullname" name="fullname" placeholder="Your full name..">
  
      <label for="phone">Phone Number</label>
      <input type="text" id="phone" name="phone" placeholder="Your phone number..">
  
      <label for="message">Message</label>
      <textarea id="message" name="message" placeholder="Write something.." style="height:100px"></textarea>
  
      <input type="submit" value="Submit">
  
    </form>
  </div>
  
</body>
</html>
<style>
body {font-family: Arial,Helvetica,sans-serif;}
*{Box-sizing: border-Box;}input[type=text],select,textarea {width: 100%;padding: 12px;border: 1px solid #ccc;border-radius: 4px;Box-sizing: border-Box;margin-top: 6px;margin-bottom: 16px;resize: vertical;}input[type=submit] { background-color: #bd1321;color: white;padding: 12px 20px;border: none;border-radius: 4px;cursor: pointer;}input[type=submit]:hover {background-color: #9c0814;}.container {border-radius: 5px;background-color: #f2f2f2;padding: 20px;}
</style>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)