联系表格未发布到 trello

问题描述

我的网站上有一个使用 Unirest 的联系表,我正在尝试将数据发布到 Trello API 以创建卡片。不断收到错误 500。这是我拥有的 index.html 和 contact.PHPhttps://trelloapi.yetitech.nz/yetitech-trello-int/

<body>
    <div class="wrapper">
        <div id="contact-form">
            <div class="container">
                <form action="contact.PHP" method="POST">
                    <input type="text" name="Name" placeholder="Name" class="form-control" />
                    <input type="email" name="email" placeholder="eMail" class="form-control" />
                    <input type="text" name="Business_Name" placeholder="Business Name" class="form-control" />
                    <input type="tel" name="Contact_Phone" placeholder="Contact Phone" class="form-control" />
                    <select name="type">
                        <option value="Website">Website</option>
                        <option value="software">Software</option>
                        <option value="hosting">Hosting</option>
                    </select>
                    <input type="text" name="Message" placeholder="Message" class="form-control"/>
                    <button type="submit" value="submit" name="submit"> Submit</button>
                        <!-- <input type="submit" name="submit" value="Submit"> -->
                </form>
            </div>
        </div>
    </div>
</body>

PHP 脚本:

<?PHP

require_once '/src/Unirest.PHP';

if (isset($_POST['submit'])){
    $name = $_POST['Name'];
    $type = $_POST['type'];
    $email = $_POST['email'];
    $business_name = $_POST['Business_Name'];
    $contact_phone = $_POST['Contact_Phone'];
    $message = $_POST['Message'];
}

$query = array(
    'key' => '{MYKEYHERE}','token' => '{MYTOKENHERE}','idList' => '{MYIdisHERE}','name' => $name,'desc' => $message
  );
  
  $response = Unirest\Request::post(
    'https://api.trello.com/1/cards',$query
  );

  var_dump($response)

?>

我正在使用这些 API 文档:https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-post

谁能看到我遗漏了什么,我的错误 500 没有给出很多指示,因为数据是通过表单解析的:

Error_message

解决方法

点击浏览器中的响应选项卡,您可以看到您在图像中显示的附近标题。然后找出错误信息有什么问题。