Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 10-06-2010, 03:31 PM   #1
LQ Newbie
Registered: Oct 2010
Posts: 1

Rep: Reputation: 0
Problem using twitter with cURL


I am trying to tweet direct message to friend account using curl.

Below is the form of twitter login page -

<form method="post" class="signin" action="
sessions"><div style="margin: 0pt; padding: 0pt;"><input type="hidden"
name="authenticity_token"></div> <input type="hidden"
name="authenticity_token" id="authenticity_token"> <input
type="hidden" name="return_to_ssl" id="return_to_ssl"> <input
type="hidden" name="redirect_after_login" id="redirect_after_login">
<fieldset class="common-form standard-form">
<table cellspacing="0">
<th><label for="username_or_email">Username or email</label></
<td><input type="text" value=""
name="session[username_or_email]" id="username_or_email"></td>
<th><label for="password">Password</label></th>
<td><input type="password" value="" name="session[password]"
id="password"> <small><a href="/account/resend_password">Forgot?</a></
<td><input type="checkbox" value="1" name="remember_me"
id="remember_me"> <label class="inline" for="remember_me">Remember me</

<td><input type="submit" value="Sign In" name="commit"
id="signin_submit" class="btn btn-m"></td>
<p>If you’ve been using Twitter from your phone, <a href="/
account/complete">click here</a> to sign up on the web.</p>

I used
curl --cookie tcookie --cookie-jar tcookie --data
"username_or_email=twitusername&password=twitpass&commit=Sign In"
I am able to get the session cookies but when i want to tweet a
"direct message" to my friend

This is the form in

<form name="f" method="post" id="direct_message_form" class="status-
update-form" action="/direct_messages/create/friendname"><div
style="margin: 0pt; padding: 0pt;"><input type="hidden"
<div class="direct-message-box">
<fieldset class="common-form standard-form">
<div class="bar">
<label for="doing">Send <a href="
freindname">friendname</a> a message.</label>
<span class="numeric" id="chars_left_notice">
<strong class="char-counter" id="status-field-char-counter"
style="color: rgb(204, 204, 204);">140</strong>
<div class="info">
<textarea rows="3" name="text" id="text" cols="15"></textarea>
<div class="status-btn">
<input type="submit" class="round-btn btn-disabled" id="dm-
submit" value="send" name="update" disabled="">

When i do
curl --cookie tcookie --data "text=Testing cURL" --data 'udpate=send'
--output twitt.html --location

But nothing happens, it is not working.

Not sure what i missed, any help is much appreciated.
Old 10-06-2010, 04:22 PM   #2
Sergei Steshenko
Senior Member
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
I am not sure, but I think Twitter has changed its authentication recently and cURL doesn't support it - there was a related thread on cURL list.

I think that Perl has a module which can work with Twitter new authentication, but I do not remember its name.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
twitter via command line (curl) and Oauth genderbender Programming 8 06-30-2012 06:37 AM
Postfix-dovecot-twitter client-whatever-problem Leseguenni Linux - Newbie 3 06-07-2010 04:00 PM
cURL: Server has many IPs, how would I make a cURL script use those IPs to send data? guest Programming 0 04-11-2009 12:42 PM
Problem using Curl srihariv Linux - General 2 03-17-2008 07:53 AM
Curl problem AkumaLoka Linux - Software 0 03-02-2003 06:07 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:02 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration