X-Twitter-Client headers?

202 views
Skip to first unread message

feasto...@gmail.com

unread,
May 31, 2007, 11:27:05 AM5/31/07
to Twitter Development Talk
I'm working on a plugin for WordPress that allows selected blog
entries to be cross-posted to Twitter. Entries will post to Twitter
perfectly, but I'm having difficulty setting the Twitter client.
Here's the relevant portion of my PHP code:

$headers = array("X-Twitter-Client" => "Auto Tweet", "X-Twitter-
Client-Version" => "1.1", "X-Twitter-Client-URL" => "http://
feastofcrumbs.com/downloads/wp-plugins/auto-tweet/auto-tweet.xml");
$curl_handle = curl_init();
curl_setopt($curl_handle,CURLOPT_URL,"$twitter_rest");
curl_setopt($curl_handle,CURLOPT_HTTPHEADER,$headers);
curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2);
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
curl_setopt($curl_handle,CURLOPT_POST,1);
curl_setopt($curl_handle,CURLOPT_POSTFIELDS,"status=$content");
curl_setopt($curl_handle,CURLOPT_USERPWD,"$username:$password");
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);


Like I said, the post is sent to Twitter perfectly and without errors,
but the X headers don't show. All my posts say "from web." Am I
passing the X headers incorrectly, or do I need to do something more
to get Twitter to recognize my client?

Alex Payne

unread,
May 31, 2007, 12:56:12 PM5/31/07
to twitter-deve...@googlegroups.com
We don't base the "from [appname]" links on the X-Twitter-Client
headers; they're simply an ad-hoc community standard that third-party
Twitter developers have agreed upon. They help us get a sense of our
traffic from API tools, but they're purely optional.

As per my announcement in a previous thread on this group, if you
message me off-list I can set you up with a "source" parameter for
your application and get you linked up. Thanks!


--
Alex Payne
http://twitter.com/al3x

mave99a

unread,
Jul 22, 2007, 11:46:21 AM7/22/07
to Twitter Development Talk
I have the same problem, no matter how I set the X-Twitter header, it
alway show "from web". :(

I steal the header which work well from AlexKing's Twittertool and
test, still don't work. Can any one help a hand to take a look?


> POST /statuses/update.xml HTTP/1.1
Authorization: Basic bWF2ZTk5YjptYW8xOTk4
User-Agent: Twitter Tools http://alexking.org/projects/wordpress
Host: twitter.com
Accept: */*
X-Twitter-Client: Twitter Tools
X-Twitter-Client-URL: http://alexking.org/projects/wordpress/twitter-tools.xml
X-Twitter-Client-Version: 1.0
Content-Length: 61
Content-Type: application/x-www-form-urlencoded

< HTTP/1.1 200 OK
< Connection: close
< Date: Sun, 22 Jul 2007 15:32:55 GMT
< Set-Cookie: _twitter_session=8fb370251909a2a4855769ac9ab7de66;
domain=.twitter
.com; path=/
< Status: 200 OK
< X-Runtime: 0.05169
< ETag: "f00cac656588bc7a5cabcf1549d37daa"
< Cache-Control: private


On Jun 1, 12:56 am, "Alex Payne" <a...@al3x.net> wrote:
> We don't base the "from [appname]" links on theX-Twitter-Client
> headers; they're simply an ad-hoc community standard that third-party
> Twitter developers have agreed upon. They help us get a sense of our
> traffic from API tools, but they're purely optional.
>
> As per my announcement in a previous thread on this group, if you
> message me off-list I can set you up with a "source" parameter for
> your application and get you linked up. Thanks!
>

Cameron Kaiser

unread,
Jul 22, 2007, 11:55:13 AM7/22/07
to twitter-deve...@googlegroups.com
> I have the same problem, no matter how I set the X-Twitter header, it
> alway show "from web". :(

The Twitter people set this up for you by hand -- just request it.

--
------------------------------------ personal: http://www.cameronkaiser.com/ --
Cameron Kaiser * Floodgap Systems * www.floodgap.com * cka...@floodgap.com
-- Condense soup, not books! --------------------------------------------------

mave99a

unread,
Jul 22, 2007, 11:57:47 AM7/22/07
to Twitter Development Talk
Oh, it need to have a "source", header is not used...

I c, after I put a source in the post body, it worked....(with alex's
twittertool source)

On Jul 22, 11:46 pm, mave99a <zhihong....@gmail.com> wrote:
> I have the same problem, no matter how I set the X-Twitter header, it
> alway show "from web". :(
>
> I steal the header which work well from AlexKing's Twittertool and
> test, still don't work. Can any one help a hand to take a look?
>
> > POST /statuses/update.xml HTTP/1.1
>
> Authorization: Basic bWF2ZTk5YjptYW8xOTk4

> User-Agent: Twitter Toolshttp://alexking.org/projects/wordpress

Reply all
Reply to author
Forward
0 new messages