On Oct 22, 2:05 am, Dave Sherohman <d...@fishtwits.com> wrote:
> On Wed, Oct 21, 2009 at 11:22:44AM -0700, JB wrote:
> > Does anyone have a way to compare these two strings in PHP?
> > I have tried 3 different ways of comparing strings and they all fail.
> > Even more so recently.
>
> > Looking for a solid way to see if a tweet was accepted by the API or
> > not.
>
> Remember that every new status will be assigned a higher ID than any
> previously-existing ID.
>
> Therefore, when you get/store the user's current statusprior to sending
> the update (which you must be doing if you have its text), you can also
> remember its ID.  Comparing the ID against the returned ID from the
> attempted update will tell you whether it was accepted or not.
> Alternately, if this is the only reason you're checking/storing the
> user's previous status, you may be able to save yourself a few API calls
> by saving the last seen ID globally instead of keeping it updated for
> each user individually.
>
> Using the ID rather than the status text should be more reliable, not
> only because numeric comparison is much more straightforward than string
> comparison, but also because the IDs are guaranteed to always be unique.
>
> This method could fail if the user updates his status using another
> application, then comes back and submits an update from yours before
> yours checks in with Twitter and is made aware of the new update, but
> there's really no way to reliably detect whether the update from your
> app has been rejected in that scenario.  Which is why Twitter really
> needs to stop rejecting updates silently and add some kind of indicator
> (a non-200 HTTP status, an extra flag in the response payload, whatever)
> to tell us when the update had been rejected (and, ideally, why).
>
> --
> Dave Sherohman

Thank you for the reply.  For some reason, I never thought about using
Status ID's.  Perhaps I was unaware that they would be progressive.

And yes.. silent rejections would be really helpful.

Reply via email to