Twitter API toplantısında "Hız Sınırı" çağrısı Curl

0 Cevap php

I'm just starting to mess around with a very, very basic call to the Twitter API (http://api.twitter.com/1/statuses/user_timeline.json) to pull my tweets to my website through cURL. However, using a page that nobody knows exists yet (thus eliminating the possibility of inadvertent traffic), I'm getting a Rate Limit Exceeded thing before I've had the chance to even test it. It says it resets at 5 past the hour, so I check again, and for a minute it works but then it's back to telling me my rate limit is exceeded. A few questions for anyone who knows about the Twitter API and/or cURL:

First, is the rate limit applied to my server (instead of the user)? I would assume so, but that could make it tough of course. Even one API call per visitor could, on a site with marginal traffic, easily surpass the rate limit in an hour. Is there a way to associate the call with the visitor, not the server? Seems like probably not, but I'm not entirely sure how the whole API works, and cURL does seem to be advocated in a number of places. I'm aware that if I use JSON and AJAX the data in I can make that request from the user, but just for the sake of argument, what about cURL?

Second, any idea how I could be surpassing my rate limit without even refreshing the page? I pay for hosting at another location, so I might be sharing server space with another site, but my site definitely has a unique IP, so that should … that should be OK, right? So how is it that I'm surpassing the rate limit without even running the code (or by running it once?)?

İşte o yardımcı olur, ben kodu var ne:

$ch=curl_init("http://api.twitter.com/1/statuses/user_timeline.json?screen_name=screenname");
    curl_setopt_array($ch,array(
            CURLOPT_RETURNTRANSFER=>true,
            CURLOPT_TIMEOUT=>5,
        )
    );
$temp=curl_exec($ch);
curl_close($ch);
$results=json_decode($temp,true);

Twitter'da Hız Sınırı hata verirse, bu sınır sıfırlamak olacağı zaman bir metin dosyasında hata kaydeder, hem de böylece Ayrıca, ben şimdi hallederim. O başka bir şey gibi değil böylece dosyasına bakarak, (Ben sadece ekler, bu yeniden zorunda değilsiniz) güncellemeleri sadece zaman, (belki bir veya iki kez bir saat içinde) sayfasını yükledim durumdur Bu sayfayı kullanarak ve bu URL çağırıyor.

Herhangi bir yardım?

0 Cevap