I'm using PHP to parse Twitter emails sent regarding Direct Messages.
I've noticed that these come with footer text added on by Twitter
("follow me at", "reply on the web", etc).

Right now, I just look for the last instance of the string segment
"--" and trim whatever text is contained within the email body from
that point.

However, I've noticed that just above the footer Twitter adds the
senders username, like so: username / username. I'm currently grabbing
the following information from the emails header: X-Twittersendername
and X-Twittersenderscreenname, and working under the assumption that
this string is essentially:

X-Twittersendername / X-Twittersenderscreenname

After that, I'm just using str_replace to strip away that text and
then trim the resulting body text to get _just_ the DM contents. But
what's the difference between the two values?

I'm just wondering if I'm acting correctly, or if there's an easier
way to do this. Note, however, that I'm not interested in grabbing the
20 latest DMs, and would instead prefer to remain parsing the emails
sent by Twitter.

Reply via email to