Welcome to WebmasterWorld Guest from 54.224.230.193

Forum Moderators: coopster & jatar k & phranque

Message Too Old, No Replies

WGET used for a Twitter software

The authentification problem

     
7:18 am on Jul 14, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member jetteroheller is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Jan 22, 2005
posts: 2993
votes: 3


I purchased in February TweetAdder Software.

But this software has so many time consuming bugs and so few features, that I feel forced to write my own Twitter software.

I use Perl and make the requests to Twitter.com with WGET.

Geting lists works fine, but now I want to sent follow and unfollow commands to Twitter requiring authentification.

First I tried the following call of WGET

"C:/Programme/GnuWin32/bin/wget.exe" --append-output=c:/twitter/twitter.log --server-response --save-headers --http-user=MYUSERNAME --http-password=MYPASSWORD --auth-no-challenge http://api.twitter.com/1/friendships/create.xml?user_id=27016367 --output-document=c:/twitter/_follow_sent.txt


After this failed always with 401 error, I tried to put direct a basic authentification line into --header

"C:/Programme/GnuWin32/bin/wget.exe" --append-output=c:/twitter/twitter.log --server-response --save-headers --header "Authorization: Basic BASE64 encoded username=password" http://api.twitter.com/1/friendships/create.xml?user_id=27016367 --output-document=c:/twitter/_follow_sent.txt

Same 401 error problem

No idea.

BTW, is there a command line useable software handling the oauth problem, basic authentification will turned off August 16th?

[edited by: phranque at 7:27 am (utc) on Jul 14, 2010]
[edit reason] unlink/de-obscure urls [/edit]

8:50 am on July 14, 2010 (gmt 0)

Junior Member

5+ Year Member

joined:May 8, 2008
posts: 74
votes: 0


There are many modules for Twitter on CPAN. Like Net::Twitter [search.cpan.org], Net::Twitter::OAuth [search.cpan.org], Net::Twitter::Lite [search.cpan.org]. There are several ready Twitter clients in Perl, but I don't remember their names.
9:11 am on July 14, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member jetteroheller is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Jan 22, 2005
posts:2993
votes: 3


My biggest problem, I am stuck with an very old version of Perl, because of using MSIE as GUI.

At a perl update, many years ago, there had been problems with the GUI updates. I tried for days, but I was not able to solve the GUI update problem with the new version.

The problem was, no GUI updates while PERL was working. So there was my work progress indicator not visible, while the system was on an 1 hour job. So I became stuck with the old version.

So I hoped for an easy way with an external software, where I can use a command line batch and pass all parameters.
9:31 am on July 14, 2010 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member tangor is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Nov 29, 2005
posts:6964
votes: 385


Hate to be the wet blanket, and probably does not apply in this case if Tweets does not forbid, but I 403 Wget and I suspect quite a few other sites do as well.
5:02 pm on July 14, 2010 (gmt 0)

Junior Member

5+ Year Member

joined:May 8, 2008
posts:74
votes: 0


You can use several versions of Perl at once, or even package your program into .exe with PAR.
6:11 pm on July 14, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member

joined:May 31, 2008
posts:661
votes: 0



You can use several versions of Perl at once, or even package your program into .exe with PAR.


Yeah, try installing both versions. PAR is probably a no-go for a web environment because I've always found it slow to start.

But generally: why not tackle the real problem: different versions of perl making problems. Maybe you'd like to explain those problems and the involvment of MSIE. I've never heard of serious problems with different perl versions before, so it might just be a small thing. That'd definetly make your life alot easier... using wget from perl when you should have LWP at your disposal is unncessary painful.
7:49 pm on July 14, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member jetteroheller is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Jan 22, 2005
posts:2993
votes: 3


Maybe you'd like to explain those problems and the involvment of MSIE


My software runs under windows as a *.hta = Hyper Text Aplication

<html>
<head>
<title>My CMS</title>

<HTA:APPLICATION ID="oHTA"
applicationname="WDS Start"
icon=../pic/wds.ico
scroll=no
singleInstance=yes
windowstate=maximize />

<body scroll=no>
<br>
<br>
loading domain list
</center>

<script language=PerlScript>

use strict "vars";
use strict "refs";
use strict "subs";
use Win32::Shell;

&init();


All the GUI is in HTML.

With <.....OnClick=SubroutineWritteninPerl(4,4)>
There is the interaction between the HTML GUI and the
Perl software.

For longer tasks, I made a progress dislay,
showing the progress of the job.

The older Perl version shows the update of the HTML when ever I want it, the new version (about 2002) only when the job is finished and the program has to wait for the next user interaction.
10:13 pm on July 14, 2010 (gmt 0)

Junior Member

5+ Year Member

joined:May 8, 2008
posts: 74
votes: 0


The older Perl version shows the update of the HTML when ever I want it, the new version (about 2002) only when the job is finished and the program has to wait for the next user interaction.


I guess by new you mean 5.8 and by older - 5.6. This may mean interaction with new Perl 5.8 idea - PerlIO. You may use binmode to change PerlIO behavior. Also you may submit a bug report to vendor - ActiveState.
4:16 am on July 15, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member jetteroheller is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Jan 22, 2005
posts:2993
votes: 3


I am using

Perl APi522e.exe 5371 KB Nov 10th 1999

I described the problem at this time at th ActiveState forum for perl, filled bug reports, but no reaction.

I had the feeling, I am the only one using MSIE as the GUI for Perl
11:17 am on July 15, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member

joined:May 31, 2008
posts:661
votes: 0


It might just be a buffering-issue, try adding
$|++;
to the script (before you output stuff, of course) to disable output buffering.

If that's not it, it might be a rendering-thing with MSIE, but that shouldn't change based on perl versions.
8:55 pm on July 15, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 27, 2001
posts:2548
votes: 0


Did you try changing your useragent?

‘-U agent-string’
‘--user-agent=agent-string’
Identify as agent-string to the http server.

The http protocol allows the clients to identify themselves using a User-Agent header field. This enables distinguishing the www software, usually for statistical purposes or for tracing of protocol violations. Wget normally identifies as ‘Wget/version’, version being the current version number of Wget.
9:07 pm on July 15, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 27, 2001
posts:2548
votes: 0

9:30 pm on July 15, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member jetteroheller is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Jan 22, 2005
posts:2993
votes: 3


You might also want to check out this IBM article


Thanks, but the examples are only with basic authentication.

Basic authentification will be tunred off by August 16th

My Perl software can actual use the API Twitter interface for all prupose where no authentification is required.

My only problem is the oAuth.
9:57 pm on July 15, 2010 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:10553
votes: 12


there are perl/oauth examples linked from Twitter API Wiki / OAuth Examples [apiwiki.twitter.com].
8:27 am on July 18, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member jetteroheller is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Jan 22, 2005
posts: 2993
votes: 3


Did you try changing your useragent?

‘-U agent-string’
‘--user-agent=agent-string’
Identify as agent-string to the http server.


The problem was Twitter accepts only POST for friendship create.
The POST ist empty.

So the WGET parameter

--post-data=

solved the problem, but only until August 16th when basic authentification is turned off