Created
November 30, 2018 02:41
-
-
Save bvlion/53ac2e3c56d222182eb433e529d6d5f4 to your computer and use it in GitHub Desktop.
asanaのセクション配下にタスクをPHPで追加するサンプル
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$data = array('data' => array( | |
'memberships' => array(array('project' => $_POST['project'], 'section' => $_POST['section'])), | |
'name' => $_POST['word'], | |
'workspace' => $_POST['workspace'], | |
'notes' => $_POST['note'] | |
)); | |
$header = array( | |
'Content-Type: application/json', | |
'Authorization: Bearer ' . $bearer | |
); | |
$options = array( | |
'http' => array( | |
'ignore_errors' => true, | |
'method' => 'POST', | |
'header' => implode("\r\n", $header), | |
'content' => json_encode($data) | |
) | |
); | |
$url = 'https://app.asana.com/api/1.0/tasks'; | |
$context = stream_context_create($options); | |
$result = file_get_contents($url, false, $context); | |
$result = json_decode($result); | |
echo $result; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment