我一直在尝试通过我的网站制作trello卡的方法,但是在填写了所有字段后,它只会制作卡,而不能做其他任何事情。该卡会显示在正确的列表中,只是上面没有描述或标题。
<!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']) . "\n";
$card_content .= htmlspecialchars($_POST['authorname']) . "\n";
$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>
我知道钥匙/令牌不存在,我将其屏蔽了。卡发送,制作卡,但标题和说明为空值。是的,这是一个php文件,所以不要问。