从提交的php文件重新填充表单
我想知道是否有一种方法可以从已经提交的php文件中重新填充表单数据? 例如 callform.php从提交的php文件重新填充表单,php,html,forms,Php,Html,Forms,我想知道是否有一种方法可以从已经提交的php文件中重新填充表单数据? 例如 callform.php <form action="sendcalltform.php" method="POST"> TWILIO SID: <input name="sid" type="text" /><br /> TWILIO TOKEN: <input name="
<form action="sendcalltform.php" method="POST">
TWILIO SID: <input name="sid" type="text" /><br />
TWILIO TOKEN: <input name="token" type="text" /><br />
NUMBER TO PLACE THE CALL: <input name="to-number" type="text" /><br />
YOUR TWILIO NUMBER: <input name="from-number" type="text" /><br />
VOICE FILE NAME: <input name="xml" type="text" /><br />
<input type="submit" name="submit" value="Save Data">
</form>
</div>
<?php
if(isset($_POST['sid']) && isset($_POST['token']) && isset($_POST['to-number']) && isset($_POST['from-number']) && isset($_POST['xml'])) {
shell_exec("sudo rm /var/www/html/led/twilio/phonecall.php");
$data = '<?php '. "\r\n". 'require __DIR__ . "/vendor/autoload.php";'. "\r\n". 'use Twilio\Rest\Client;'. "\r\n". '$account_sid = "'. $_POST['sid'] . '";' . "\r\n". '$auth_token = "'. $_POST['token'] . '";' . "\r\n". '$client = new Client($account_sid, $auth_token);' . "\r\n" . '$to_number = "'. '+'. $_POST['to-number'] . '";'. "\r\n". '$twilio_number = "'. '+'. $_POST['from-number'] . '";'. "\r\n" .'$client = new Client($account_sid, $auth_token);' ."\r\n" .'$client->account->calls->create(' ."\r\n" .'$to_number,' . "\r\n" .'$twilio_number,' . "\r\n" .'array(' . "\r\n" .'"url" => "http://raspled.com/voices/' . $_POST['xml'] .'"' .')' ."\r\n" .');';
$ret = file_put_contents('phonecall.php', $data, FILE_APPEND | LOCK_EX);
if($ret === false) {
die('There was an error writing this file');
}
else {
echo "$ret bytes written to file";
}
}
else {
die('no post data to process');
}
TWILIO SID:
TWILIO令牌:
拨打电话的号码:
您的号码:
语音文件名:
<?php
require __DIR__ . "/vendor/autoload.php";
use Twilio\Rest\Client;
$account_sid = "AC9c5f843a3b8542e7266e4c89";
$auth_token = "7f949e69ef0a2b7e6960ba7124";
$client = new Client($account_sid, $auth_token);
$to_number = "+19294589786";
$twilio_number = "+13024721330";
$client = new Client($account_sid, $auth_token);
$client->account->calls->create(
$to_number,
$twilio_number,
array(
"url" => "http://someplace.com/voices/data.xml")
);