This is a great thread. I was about to post the same. Since mid-december, I’m getting tons of timeout errors because of api.twitter.com (I’m on OVH as well). Before that, I was having maybe one cURL timeout every month, and my app does hundreds of API calls every day, if not thousands.
I extended the retry function which I implemented in the TwitterOauth PHP library earlier to retry when I was getting 500+ errors from Twitter API. Now it handles cURL timeouts as well.
Even with this retry function (up to 5 times), a lot of API calls didn’t make it. Various endpoints, not just one (status/update, mentions_timeline etc). After debugging cURL, I found out that most of the timeouts come from the IP 104.244.42.2.
Therefore, I changed my /etc/hosts to this:
104.244.42.194 api.twitter.com
I picked this IP because out of the 4 IPs of api.twitter.com, it was the less present in my curl Timeouts log through several days. And it worked. Since I did that, I almost get no timeout at all.
If that can help.