【问题标题】:Contact form not posting to trello联系表格未发布到 trello
【发布时间】:2021-07-26 10:13:36
【问题描述】:

我在我的网站上有一个使用 Unirest 的联系表我正在尝试将数据发布到 Trello API 创建一张卡片。不断收到错误 500。这是我拥有的 index.html 和 contact.php。 https://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

【问题讨论】:

    标签: php trello


    【解决方案1】:

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

    【讨论】:

    • 它说“这个请求没有可用的响应数据”
    猜你喜欢
    • 2011-10-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-22
    • 2016-02-07
    相关资源
    最近更新 更多