#!/usr/bin/perl -w #process_post.pl #A Yahoo club message poster. #Adam Russell(sail0r@creepjoint.net) #28 July 2001 use HTTP::Cookies; use HTML::Form; use LWP; #### #Now lets do the posting #0.)Login to yahoo #### $ua=new LWP::UserAgent; #Create a new user agent $ua->from('sail0r@creepjoint.net'); $url='http://post.clubs.yahoo.com/clubs/CLUBNAME/bbs?action=r;sid=CLUBSID&tid=CLUBTID;mid=0'; #Create a login request $login_req = HTTP::Request->new(GET => $url); $login_res = $ua->request($login_req);#make the initial request.(to get the cookies) $html = $login_res->content; #grab the resulting web page from the request $form = HTML::Form->parse($html,$url);#Parse the content for the login form $form->value('login',$LOGIN); #fill in the login form....... $form->value('passwd',$PASSWD); $req = $form->click; #and post it $res = $ua->request($req); #now yahoo wants to redirect. Make sure we...... $cookie_jar = HTTP::Cookies->new(); #create a cookie jar $cookie_jar->extract_cookies($res); #know what cookies yahoo needs....... $goto = $res->header('location'); #where yahoo wants us to go....... $new_req = HTTP::Request->new(GET => $goto);#generate a request to go there....... $cookie_jar->add_cookie_header($new_req);#and let yahoo know we have their cookies. $new_res = $ua->request($new_req); #engage!! #### # #1.)Now parse out the form returned from above in $new_res and do the post #### $html = $new_res->content; $club_form = HTML::Form->parse($html,$url);#Parse the content for the posting form $cookie_jar->extract_cookies($new_res); #get the cookies we need in order to post $club_form->value('Subject',$Subject);#fill in the subject $club_form->push_input("textarea",{"name"=>"posting"});#create the "textarea" for the post. $input = $club_form->find_input("posting","textarea"); #get a reference to the textarea $input->value($Post); #fill the textarea in with the posting $req = $club_form->click; #create a request for the post $cookie_jar->add_cookie_header($req); #don't forget the cookies!! $res = $ua->request($req); #engage!!