将HTML输入发送到PHP Twilio脚本
我不熟悉PHP和HTML表单。我正在尝试将下面的表单数据发送到我的PHP脚本sendsms.PHP。PHP脚本似乎没有从html表单获取输入数据将HTML输入发送到PHP Twilio脚本,php,html,twilio,Php,Html,Twilio,我不熟悉PHP和HTML表单。我正在尝试将下面的表单数据发送到我的PHP脚本sendsms.PHP。PHP脚本似乎没有从html表单获取输入数据 <form action="sendsms.php" method="post" > <div id="space">Cell:<div><input type="number" name="phone" id="number" ></div></div>
<form action="sendsms.php" method="post" >
<div id="space">Cell:<div><input type="number" name="phone" id="number" ></div></div>
<div id="space"><div>Message</div><div><input type="text" name="message" id="message"> </div></div>
<div id="button"><input type="submit" name="send" value="Send" id="button" ></div>
</form>
单元格:
消息
这是我的PHP文件sendsms.PHP
<?php
// this line loads the library
require('twilio-php/Services/Twilio.php');
$account_sid = 'REMOEVD';
$auth_token = 'REMOVED';
$client = new Services_Twilio($account_sid, $auth_token);
$client->account->messages->create(array(
'To' => $_POST['phone'];,
'From' => "+16194523868",
'Body' => $_POST['message'];,
));
如果您查看表单:
<form action="sendsms.php" method="post" >
编辑
刚刚注意到数组声明中还有一些分号(;
),这些分号仍然会破坏代码您使用的是method=“post”
,但是试图读取$\u GET
,您需要使用$\u REQUEST
或$\u post
Dang我知道它是这样的小东西!谢谢你!
$client->account->messages->create(array(
'To' => $_POST['phone'],
'From' => "+16194523868",
'Body' => $_POST['message']
));