10 $PROGRAM_DIR =~ s/[^\/\\]+$//;
11 $PROGRAM_DIR = "./" unless($PROGRAM_DIR);
13 map "$PROGRAM_DIR$_",qw{modules lib
../modules
..lib
};
17 my @OPTIONS = qw
/help|h|? version|ver edit-me manual|man/;
22 require MyPlace
::Usage
;
23 Getopt
::Long
::GetOptions
(\
%OPTS,@OPTIONS);
24 MyPlace
::Usage
::Process
(\
%OPTS,$VERSION);
28 require MyPlace
::Usage
;
29 MyPlace
::Usage
::PrintHelp
();
32 die("This program doesn't work.\n");
34 die("Usage:$0 url\n") unless($url);
42 tr/a-zA-Z#/n-za-mN-ZA-M@/;
48 my $COOKIE_FILENAME = $ENV{'HOME'} . "/.myplace_curl.cookie";
49 my $CURL = MyPlace
::Curl
->new;
50 $CURL->set("cookie",$COOKIE_FILENAME);
51 $CURL->set("cookie-jar",$COOKIE_FILENAME);
52 $CURL->set("user-agent","Mozilla/5.0");# (X11; U; Linux i686; en-US; rv:1.9.0.3) Gecko/2008092416 Firefox/3.0.3 Firefox/3.0.1");
54 my ($_U,$_P)=_E
("keysha#tznvy.pbz","nofserrqbz");
57 client
=>"ssologin.js%28v1.3.9%29",
64 url
=>uri_unescape
("http%3A%2F%2Ft.sina.com.cn%2Fajaxlogin.php%3Fframelogin%3D1%26callback%3Dparent.sinaSSOController.feedBackUrlCallBack"),
67 $POSTDATA{_E
("hfreanzr")}=$_U;
68 $POSTDATA{_E
("cnffjbeq")}=$_P;
69 my $LOGINURL='http://login.sina.com.cn/sso/login.php?client=ssologin.js(v1.3.9)';
71 #die(join(" ",_E("user","name","pass","word")));
74 $CURL->set('referer',$url);
75 my ($exit_code,$data) = $CURL->get($url);
76 if(!$exit_code == 0) {
77 print STDERR
"Error when retriving '$url',\n";
79 elsif($data =~ /;return false;">登录<\/a>/) {
80 print STDERR
"Trying to login first [$LOGINURL]...\n";
81 $CURL->set('location');
82 ($exit_code,$data) = $CURL->post($LOGINURL,$url,%POSTDATA);
83 ($exit_code,$data) = $CURL->get(uri_unescape
('http%3A%2F%2Ft.sina.com.cn%2Fajaxlogin.php%3Fframelogin%3D1%26callback%3Dparent.sinaSSOController.feedBackUrlCallBack?retcode=6102'));
84 print STDERR
"Reloading [$url]...\n";
85 ($exit_code,$data) = $CURL->get($url);
100 t.sina.com.cn - PERL script
104 t.sina.com.cn [options] ...
112 Print version infomation.
114 =item B<-h>,B<--help>
116 Print a brief help message and exits.
118 =item B<--manual>,B<--man>
120 View application manual
124 Invoke 'editor' against the source
134 2010-08-14 xiaoranzzz <xiaoranzzz@myplace.hell>
140 xiaoranzzz <xiaoranzzz@myplace.hell>