Recent activity
Subscribe to this feed
sander replied on November 04, 2009 14:04 to the question "How to use PHP to access the API to login, and get all entries for one day." in Toggl:
sander replied on November 03, 2009 14:56 to the question "How to use PHP to access the API to login, and get all entries for one day." in Toggl:
sander replied on October 28, 2009 09:38 to the question "How to use PHP to access the API to login, and get all entries for one day." in Toggl:
This one works for me.
<?php // This will be where we test the api to Toggl
$target = "http://www.toggl.com";
$cookie_file = 'cookies.txt';
// Remove the current cookie file
unlink($cookie_file);
$send_data = array();
$send_data['start_date_ms'] = strtotime(date("m/d/Y 00:00:00")) * 1000;
$send_data['end_date_ms'] = strtotime(date("m/d/Y 00:00:00")) * 1000;
$send_data['version'] = '1.13.2';
$send_data['tzoffset'] = '0';
$send_data['user_login'] = "123";
$send_data['user_password'] = "123";
$login = curl_init();
curl_setopt($login, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($login, CURLOPT_HTTPHEADER, array('Accept: application/json', 'Content-Type: application/json'));
curl_setopt($login, CURLOPT_URL, $target.'/user/login');
curl_setopt($login, CURLOPT_POSTFIELDS, json_encode($send_data));
curl_setopt($login, CURLOPT_COOKIESESSION, TRUE);
curl_setopt($login, CURLOPT_COOKIEFILE, $cookie_file);
curl_setopt($login, CURLOPT_COOKIEJAR, $cookie_file);
$login_details = json_decode(curl_exec($login));
curl_close($login); // This is moved up here (it was at the end)
$get_details = curl_init();
curl_setopt($get_details, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($get_details, CURLOPT_HTTPHEADER, array('Accept: application/json', 'Content-Type: application/json'));
curl_setopt($get_details, CURLOPT_URL, $target.'/task/list');
curl_setopt($get_details, CURLOPT_POSTFIELDS, json_encode($send_data));
curl_setopt($get_details, CURLOPT_COOKIEFILE, $cookie_file);
curl_setopt($get_details, CURLOPT_COOKIEJAR, $cookie_file);
$list_details = json_decode(curl_exec($get_details));
curl_close($get_details);
$currentTime = 0;
$theEntries = array();
foreach($list_details?>content as $tmp_detail)
{
if($tmp_detail->duration > 0)
{
// Break down the number into .25 increments
$theAmount = number_format(((($tmp_detail->duration / 1000) / 60) / 15)) * .25;
$theEntries[$tmp_detail->description] = $theAmount;
$currentTime = $currentTime + $theAmount;
}else{
// This is the end all so it must equal 4 or 8 depending on when we run this.
$offset = 4 - $currentTime;
$theEntries[$tmp_detail->description] = $offset;
}
}
echo "
";
print_r($theEntries);
echo "
";
?>-
sander replied on September 24, 2009 09:58 to the question "Fail to connect using the Toogl API" in Toggl:
What programming language are you using to connect? I'll try and post a working login sequence if you tell me the language.
You set the content type header to 'application/x-www-form-urlencoded' and use the /user/login url. This will not invoke the API. The server should respond to this request with a HTML page or a redirect to the /home url. If you want to use the API, set the content type to 'application/json' and use the url '/user/login.json'. In this case the server should respond with a JSON reply.
The post should be JSON, as in {"tzoffset":0, "user_login":"myuser", "user_password":"mypassword", "version":"1.13.2"}. Using x-www-form-urlencoded might work, but has never been tested. In any case use user_login and user_password instead of user-login and user-password (the hyphen is only used in the XML api).
Hope this helps
sander replied on September 11, 2009 12:03 to the problem "Toggle widget using 1.2 GB (!) memory" in Toggl:
sander replied on September 11, 2009 08:20 to the problem "Toggle widget using 1.2 GB (!) memory" in Toggl:
You can download the debug version here:
http://download.toggl.com/widget/Togg...
Toggl Desktop is built with gcc on mingw. I enabled the -g option for compiling the .o files. The embedded static Qt libraries are release versions (as it would take us several days to build debug libraries on the build VM).
Let us know if you need anything else.
sander replied on April 27, 2009 11:10 to the question "How to use PHP to access the API to login, and get all entries for one day." in Toggl:
sander replied on April 22, 2009 15:26 to the question "How to use PHP to access the API to login, and get all entries for one day." in Toggl:
You didn't handle cookies.
Toggl creates a _toggl_session cookie upon logging in, you need to pass that along to any subsequent requests.
Code here:
<?php // This will be where we test the api to Toggl
$target = "http://www.toggl.com";
$cookie_file = 'cookies.txt';
$send_data = array();
$send_data['start_date_ms'] = strtotime(date("m/d/Y 00:00:00")) * 1000;
$send_data['end_date_ms'] = strtotime(date("m/d/Y 23:59:59")) * 1000;
$send_data['version'] = '0.16.12';
$send_data['tzoffset'] = '0';
$send_data['user_login'] = {username or email};
$send_data['user_password'] = {password};
$login = curl_init();
curl_setopt($login, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($login, CURLOPT_HTTPHEADER, array('Accept: application/json', 'Content-Type: application/json'));
curl_setopt($login, CURLOPT_URL, $target.'/user/login');
curl_setopt($login, CURLOPT_POSTFIELDS, json_encode($send_data));
// This is added
curl_setopt($login, CURLOPT_COOKIESESSION, TRUE);
curl_setopt($login, CURLOPT_COOKIEFILE, $cookie_file);
curl_setopt($login, CURLOPT_COOKIEJAR, $cookie_file);
// ***
$login_details = json_decode(curl_exec($login));
echo "<stron?>Login Details<br />";
echo "<pre>";
print_r($login_details);
echo "</pre>";
curl_close($login); // This is moved up here (it was at the end)
$get_details = curl_init();
curl_setopt($get_details, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($get_details, CURLOPT_HTTPHEADER, array('Accept: application/json', 'Content-Type: application/json'));
curl_setopt($get_details, CURLOPT_URL, $target.'/task/list');
curl_setopt($get_details, CURLOPT_POSTFIELDS, json_encode($send_data));
// This is added
curl_setopt($get_details, CURLOPT_COOKIEFILE, $cookie_file);
curl_setopt($get_details, CURLOPT_COOKIEJAR, $cookie_file);
// ***
$list_details = json_decode(curl_exec($get_details));
echo "<strong>List Details</strong><br />";
echo "<pre>";
print_r($list_details);
echo "</pre>";
curl_close($get_details);
?>
sander replied on April 06, 2009 10:04 to the problem "Toggl assigns tasks to previous day, even after midnight" in Toggl:
sander replied on March 27, 2009 13:48 to the question "API requests with PHP curl?" in Toggl:
sander replied on March 27, 2009 13:03 to the question "API requests with PHP curl?" in Toggl:
sander replied on August 05, 2008 12:50 to the problem "Some time-logs in daily reports seem to be bogus" in Toggl:
sander replied on August 05, 2008 12:37 to the question "change email address" in Toggl:
sander replied on June 12, 2008 11:31 to the question "Add Team Members?" in Toggl:
sander replied on June 11, 2008 15:35 to the question "Past Tasks" in Toggl:
You can create a task now and later change its start time to yesterday. There is an edit link in Toggl Desktop and Toggl Timer, where you can edit the start date and time for the task.
Also, you can open the task up from the tasks report (by clicking on the task description) and edit the start time from there.
sander replied on June 11, 2008 15:29 to the problem "Don't see any Tasks all of a sudden" in Toggl:
sander started a conversation in Toggl on June 11, 2008 15:17:
Tasks disappearing on June 11thDue to a technical problem, tasks in our database were rendered inaccessible for about 1 hour. We managed to fix this problem in short order. However, some inconsistencies may remain, and as such you are advised to recheck your tasks registered on June 11th.
sander replied on June 06, 2008 12:23 to the discussion "API Issues" in Toggl:
Loading Profile...
