Updated code that includes better cookie management. It maybe updated, but it still doesn't work!
#!/usr/bin/perl use strict; use warnings; use CGI ':standard'; use MySpace::Configuration; use MySpace::MySpaceUserAgent; use HTTP::Cookies; use HTML::Form; use HTML::LinkExtor; use Data::Dumper; # Load Configuration File my $configuration = MySpace::Configuration->new("config/myspace_mikeba +as.conf", "config"); # Create Authenticated MySpace Browser my $cookie_jar = HTTP::Cookies->new('file'=> $configuration->cookies_d +ir, 'autosave' => 1); my $browser = MySpace::MySpaceUserAgent->new( cookies_dir => $configuration->cookies_dir, login_url => $configuration->login_url, username => $configuration->username, password => $configuration->password ); my $browse_url = 'http://browseusers.myspace.com/Browse/Browse.aspx'; my $response; $cookie_jar->extract_cookies($response); $response = $browser->get($browse_url); my @forms = HTML::Form->parse($response); # Pull ACTION out of JavaScript function my $content = $response->content; $content =~ m{document\.frmBrowse\.action = "(.*?)"}; my $action_url = "http://browseusers.myspace.com/Browse/" . "$1"; $forms[1]->action($action_url); my $action = $forms[1]->action; # Get Form Elements my $zipRadius = $forms[1]->find_input("zipRadius", "option"); + my $zipCode = $forms[1]->find_input("zipCode", "text"); my $minAge = $forms[1]->find_input("minAge", "option"); my $maxAge = $forms[1]->find_input("maxAge", "option"); #my $Scope = $forms[1]->find_input("Scope", "radio"); my $showHasPhotoOnly = $forms[1]->find_input("showHasPhotoOnly", "che +ckbox"); my $showNamePhotoOnly = $forms[1]->find_input("showNamePhotoOnly", "ch +eckbox"); # Get Hidden Values my $update = $forms[1]->find_input("update", "submit"); my $__EVENTTARGET = $forms[1]->find_input("__EVENTTARGET"); my $Page = $forms[1]->find_input("Page"); # Assign Values $zipRadius->value("Any"); $zipCode->value(""); $minAge->value("18"); $maxAge->value("100"); #$Scope->value("scopeFullNetwork"); # [scopeFullNetwork|*sco +peMyFriends] $showHasPhotoOnly->value("on"); $showNamePhotoOnly->value("on"); # Assign Hidden Values $update->value(""); $__EVENTTARGET->value("update"); $Page->value("1"); # Dump Form #print $forms[1]->dump; # Update Form my $filled_out_request = $forms[1]->click; $cookie_jar->add_cookie_header($filled_out_request); #print $filled_out_request->as_string; $cookie_jar->extract_cookies($response); $response = $browser->request($filled_out_request); # Parse Content For Links my $p = HTML::LinkExtor->new; $p->parse($response->content); my @links = $p->links; push my @urls, map {$_->[2]} @links; # Remove Duplicates my %saw; @saw{@urls} = (); my @unique_urls = sort keys %saw; # Parse Urls my @pages; foreach my $sorted_url (@unique_urls) { # Friend Urls if ($sorted_url =~ m{http://profile.myspace.com/index.cfm\?fuseactio +n=user.viewProfile&friendID=(.*?)&}) { my $friend_id = $1; #print "$friend_id\n"; } # Page Urls if ($sorted_url =~ m{javascript:GotoPage\((.*?)\)\;}) { my $page = $1; push(@pages, $page); } } # Get Last Page my $lastpage = pop @pages; # print "$lastpage\n"; # Parse Content On Current Page To Get New Token $content = $response->content; $content =~ m{document\.frmBrowse\.action = "(.*?)"}; $action_url = "http://browseusers.myspace.com/Browse/" . "$1"; $forms[1]->action($action_url); $action = $forms[1]->action; # Set New Hidden Values $__EVENTTARGET->value(""); $Page->value("$lastpage"); # Submit New Form $filled_out_request = $forms[1]->click; $cookie_jar->add_cookie_header($filled_out_request); #print $filled_out_request->as_string; $response = $browser->request($filled_out_request); # Print Content $content = $response->content; print $content;

In reply to Re: HTML::Form Submit Issue - Part II by initself
in thread HTML::Form Submit Issue - Part II by initself

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.