Connection Issues

32 views
Skip to first unread message

Hunter

unread,
Jan 17, 2013, 1:55:21 PM1/17/13
to less-acco...@googlegroups.com
Hello!

I've been running into a weird connection issue recently. To keep things simple I have a simple script that just does a GET request on an expense id. If i run the script it will return a status code of 0, but if I refresh again immediately after, it will connect and return a status code of 200 (and send the appropriate data). If i hit refresh again immediately it will work as desired, however if I leave it sit for, say, 10 minutes, and refresh it will return a status code of 0.

Any idea whats going on?

Thanks!

Steven Bristol

unread,
Jan 17, 2013, 2:02:01 PM1/17/13
to less-acco...@googlegroups.com
Can you send the script?

Hunter

unread,
Jan 26, 2013, 4:50:59 PM1/26/13
to less-acco...@googlegroups.com, st...@lesseverything.com
Here is a simplified version of my script that still produces the described results. I've been running this script nightly and I get about a 80% error rate with it connecting.

$less_biz_name = '<redacted>';
$less_username = '<redacted>';
$less_password = '<redacted>';
$less_api_key = '<redacted>';

$expense_id = '<redacted>';

$expense_url = "expenses/".$expense_id.".xml";
$url = "https://$less_biz_name.lessaccounting.com/$expense_url?api_key=".$less_api_key;

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERPWD, $less_username.':'.$less_password);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, '3');
$result = trim(curl_exec($ch));
$http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
var_dump($http_status);
var_dump($result);

Thanks!

Eugen Minciu

unread,
Jan 27, 2013, 12:17:40 PM1/27/13
to less-acco...@googlegroups.com, st...@lesseverything.com
Hi Hunter. 

Have you tried increasing CURLOPT_TIMEOUT? Can you try running the same thing with, say, a value of '10' to see if that helps with the error rate?

-- 
Eugen Minciu
Sent with Sparrow

--
You received this message because you are subscribed to the Google Groups "Less Accounting API" group.
To post to this group, send email to less-acco...@googlegroups.com.
To unsubscribe from this group, send email to less-accounting...@googlegroups.com.
Visit this group at http://groups.google.com/group/less-accounting-api?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Hunter

unread,
Jan 30, 2013, 8:45:33 PM1/30/13
to less-acco...@googlegroups.com, st...@lesseverything.com
Thanks Eugen. That seems to have worked!
To unsubscribe from this group, send email to less-accounting-api+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages