Skip to content

Instantly share code, notes, and snippets.

@AWeg
AWeg / CopyAsanaTasks.php
Last active May 5, 2020 01:04 — forked from mhdhejazi/CopyAsanaTasks.php
main changes: - Asana has own SSL cert -> had to add to lines of code - copies subtasks and up to 11 subtasks of subtasks - copies tags -> only tagnames not followers/descriptions
function asanaRequest($methodPath, $httpMethod = 'GET', $body = null)
{
$apiKey = 'ASANA_API_KEY_HERE'; /// Get it from http://app.asana.com/-/account_api
$url = "https://app.asana.com/api/1.0/$methodPath";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC ) ;
curl_setopt($ch, CURLOPT_USERPWD, $apiKey);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);