【问题标题】:Can't use the get method for PHP script无法对 PHP 脚本使用 get 方法
【发布时间】:2016-12-13 17:44:16
【问题描述】:

我需要将两个表单输入放入一个 php 脚本中。我使用 get 方法,但是当我尝试在我的网络服务器上运行代码时,出现 500 错误。

index.html

<!DOCTYPE html>
<html>
<head>
	<title>SMS</title>
</head>
<body>
<form action="send_besked.php" method="get">
Tlf:: <input type="text" name="number"><br>
Besked: <input type="text" name="msg"><br>
<input type="submit">
</form>


</body>
</html>

这里是 send_besked.php

<?php
// Required if your environment does not handle autoloading
require __DIR__ . '/vendor/autoload.php';

// Use the REST API Client to make requests to the Twilio REST API
use Twilio\Rest\Client;

// Your Account SID and Auth Token from twilio.com/console
$sid = 'xxxxx';
$token = 'xxxxx';
$client = new Client($sid, $token);

// Use the client to do fun stuff like send text messages!
$client->messages->create(
    // the number you'd like to send the message to
    '($_GET["number"])',
    array(
        // A Twilio phone number you purchased at twilio.com/console
        'from' => '+19152282067',
        // the body of the text message you'd like to send
        'body' => 'echo ($_GET["msg"])'
    )
);

我已经删除了我的访问令牌和我的 sid。

【问题讨论】:

  • 您有权访问您的服务器日志吗? 500 个错误会在日志中写入一些内容,让您了解发生了什么。

标签: php html forms twilio


【解决方案1】:

为什么在向服务器提交数据时不使用POST(in form tag)方法?一般GET用于从服务器获取数据,POST用于向服务器提交数据。

【讨论】:

    【解决方案2】:

    我想通了。

    我把它变成了一个帖子脚本并删除了以下符号

    '

    感谢您的帮助

    【讨论】:

      猜你喜欢
      • 2018-12-14
      • 1970-01-01
      • 2010-10-08
      • 1970-01-01
      • 2014-03-17
      • 2012-06-03
      • 2017-12-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多