dongtong848825 2018-12-23 19:00
浏览 202

如何制作带有表格数据的trello卡?

I have been working on a way of making a trello card through my website but with all the fields filled out, it will only make the card and nothing else. The card appears in the correct list, just with no description or title on it.

<!DOCTYPE html>
<html lang="en">

<?php
   ob_start();
   session_start();
?>

<?
   // error_reporting(E_ALL);
   // ini_set("display_errors", 1);
?>

    <head>
        <title>Some Major Oofery About</title>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <!-- import the webpage's stylesheet -->
        <link rel="stylesheet" href="/ohr.css">

        <!-- import the webpage's javascript file -->
        <script src="/script.js" defer></script>
      </head>

      <div class="form-createcard">
<?php
if ($_POST) {
  $card_name = htmlspecialchars($_POST['cardname']);
  $card_content = htmlspecialchars($_POST['carddesc']) . "
";
  $card_content .= htmlspecialchars($_POST['authorname']) . "
";
  $card_content .= htmlspecialchars($_POST['duedate']);

  $trello_key          = '---';
  $trello_api_endpoint = 'https://api.trello.com/1';
  $trello_list_id      = '---';
  $trello_member_token = '---'; // Guard this well

  $url = 'https://api.trello.com/1/cards';
  $fields='token='.$trello_member_token;
  $fields.='&key='.$trello_key;
  $fields.='&idList='.$trello_list_id;
  $fields.='&name='.$card_name;
  $fields.='&desc='.$card_content;

  $result = trello_post($url, $fields);
}

function trello_post($url, $fields){
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
  curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
  curl_setopt($ch, CURLOPT_HEADER, 0);    curl_setopt($ch, CURLINFO_HEADER_OUT, true);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_TIMEOUT, 0);
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  $output = curl_exec($ch);
  curl_close($ch);
  return json_decode($output);
}
?>
</div>

    <body>
        <header class="header">

    <div class="centered">
            <h1>Create Trello Card to <a href="---">Suspensions/Some Major Oofery Board</a></h1>
            <form class = "form-createcard" role = "form" 
            action = "<?php echo htmlspecialchars($_SERVER['PHP_SELF']); 
            ?>" method = "post">
            <input id="cardname" type="text" placeholder="Card Name">
            <input id="duedate" type="date" placeholder="Due Date">
            <input id="carddesc" type="text" placeholder="Card Description">
            <input id="authorname" type="text" placeholder="Your Name">
            <button name="submit" type="submit" id="trellosubmit">Submit Entry</button>
            </form>
        <hr>
    </div>

I know the key/token are not there, I blocked them out. The card sends, makes the card, but the title and description are empty values. Yes, this is a php file so dont ask.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 关于大棚监测的pcb板设计
    • ¥20 sim800c模块 at指令及平台
    • ¥15 stm32开发clion时遇到的编译问题
    • ¥15 lna设计 源简并电感型共源放大器
    • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
    • ¥15 Vue3地图和异步函数使用
    • ¥15 C++ yoloV5改写遇到的问题
    • ¥20 win11修改中文用户名路径
    • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
    • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计