ForumsDevelopersRequest to API v2


Request to API v2
Author Message
sandro.krumbein

Posted: Mar 27, 2014
Score: 0 Reference
Hello!

I am having problems with an API request to v2 since a few days. The script (PHP) has never failed me in during the year. Now it's stuck at the point where the Curl request to the API is made.

$url = http://api.toodledo.com/2/tasks/get.php
$fields = key=SomeRealKeyDifferentFromThisOne&modafter=1393312365&num=1000&start=1&fields=folder,tag

Here is the curl execution function:
unction curlRequest($url, $fields)
{
//initializing the curl object
$ch = curl_init($url);

//return the result as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//set content type to be json
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/x-www-form-urlencoded; charset=utf-8"));

curl_setopt($ch, CURLOPT_POST, 1);
//setting the data to be posted
if ($fields <> '')
{
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
}

//get the response
$jsonResponse = curl_exec($ch);

and then some more, the last command is the script gets stuck at

Has anything changed with respect to what I am doing here?

Regards,
Sandro
Jake

Toodledo Founder
Posted: Mar 27, 2014
Score: 0 Reference
We have not changed anything that I know of that would cause an error. When you say that it gets stuck, what exactly do you mean? Do you get any error messages?
sandro.krumbein

Posted: Mar 27, 2014
Score: 0 Reference
I DID mean is that when I put an

exit;

right before that last line, I get a response immediately. Alle the debug information I have put before that...

When I put it after that, it takes forever (I always stopped after two or three minutes at latest).

Now however, I have to say, that it works again. No idea way. And I will only start to care, if it happens again ;-)

P.S. The getting stuck was no isolated incident. I have tried a dozen times over the course of two days. Maybe there were some issues with my provider? That the curl call simply didn't go out from their servers? I don't know...

P.P.S. Thank you for caring :-)
Jake

Toodledo Founder
Posted: Mar 27, 2014
Score: 0 Reference
Who is your ISP?
sandro.krumbein

Posted: Mar 28, 2014
Score: 0 Reference
What I meant was host: it's Strato, Germany, with a PowerWeb Perfect package

My ISP (just in case it actually matters) is Telekom. But the script was hosted on the Strato server
You cannot reply yet

U Back to topic home

R Post a reply

To participate in these forums, you must be signed in.