Toodledo To-Do List

$url = “http://api.toodledo.com/2/tasks/add.php”;

$task[0][‘title’] = ‘task 1 é’;
$task[1][‘title’] = ‘task 2 字’;
$task[2][‘title’] = ‘task 3 “‘;

$json = json_encode($task);
//[{“title”:”task 1 \u00e9″},{“title”:”task 2 \u5b57″},{“title”:”task 3 \””}]

$encoded = urlencode($json);
/*
%5B%7B%22title%22%3A%22task+1+%5Cu00e9%22%7D%2C%7B%22title%22%3A%22task+2+%5Cu5b57
%22%7D%2C%7B%22title%22%3A%22task+3+%5C%22%22%7D%5D
*/

$params = “key=”.$key.”&tasks=”.$encoded;

$response = curlPOST($url,$params);
/*
[{“id”:”123456″,”title”:”task 1 \u00e9″,”modified”:1305646345,”completed”:0},
{“id”:”123457″,”title”:”task 2 \u5b57″,”modified”:1305646345,”completed”:0},
{“id”:”123458″,”title”:”task cbd products \””,”modified”:1305646345,”completed”:0}]
*/

$added = json_decode($response);

Filed under: Projects
   

Cart