LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


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

Rep: Reputation: 0
Problem using twitter with cURL


Hi,

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

Below is the form of twitter login page - http://twitter.com/login

<form method="post" class="signin" action="https://twitter.com/
sessions"><div style="margin: 0pt; padding: 0pt;"><input type="hidden"
value="4ad181cd7c23bb9cf5691e95e9b5f60545f7e91e"
name="authenticity_token"></div> <input type="hidden"
value="4ad181cd7c23bb9cf5691e95e9b5f60545f7e91e"
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">
<tbody><tr>
<th><label for="username_or_email">Username or email</label></
th>
<td><input type="text" value=""
name="session[username_or_email]" id="username_or_email"></td>
</tr>
<tr>
<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></
small></td>
</tr>
<tr>
<th></th>
<td><input type="checkbox" value="1" name="remember_me"
id="remember_me"> <label class="inline" for="remember_me">Remember me</
label></td>
</tr>

<tr>
<th></th>
<td><input type="submit" value="Sign In" name="commit"
id="signin_submit" class="btn btn-m"></td>
</tr>
<tr>
<th></th>
<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>
</td>
</tr>
</tbody></table>
</fieldset>
</form>

I used
curl --cookie tcookie --cookie-jar tcookie --data
"username_or_email=twitusername&password=twitpass&commit=Sign In"
http://twitter.com/login
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 http://twitter.com/direct_messages/create/friendname

<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"
value="4ad181cd7c23bb9cf5691e95e9b5f60545f7e91e"
name="authenticity_token"></div>
<div class="direct-message-box">
<fieldset class="common-form standard-form">
<div class="bar">
<h3>
<label for="doing">Send <a href="http://twitter.com/
freindname">friendname</a> a message.</label>
</h3>
<span class="numeric" id="chars_left_notice">
<strong class="char-counter" id="status-field-char-counter"
style="color: rgb(204, 204, 204);">140</strong>
</span>
</div>
<div class="info">
<textarea rows="3" name="text" id="text" cols="15"></textarea>
</div>
<div class="status-btn">
<input type="submit" class="round-btn btn-disabled" id="dm-
submit" value="send" name="update" disabled="">
</div>
</fieldset>
</div>
</form>

When i do
curl --cookie tcookie --data "text=Testing cURL" --data 'udpate=send'
--output twitt.html --location http://twitter.com/direct_messages/create/friendname

But nothing happens, it is not working.

Not sure what i missed, any help is much appreciated.
 
Old 10-06-2010, 03: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.
 
  


Reply



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 05:37 AM
Postfix-dovecot-twitter client-whatever-problem Leseguenni Linux - Newbie 3 06-07-2010 03: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 11:42 AM
Problem using Curl srihariv Linux - General 2 03-17-2008 06:53 AM
Curl problem AkumaLoka Linux - Software 0 03-02-2003 05:07 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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

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