Thread: Noobie question

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    12
    Rep Power
    0

    Noobie question


    $agent->submit();

    $agent->follow_link( ?/donate.php => qr/example/i );

    how to fix this error :S
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2012
    Posts
    828
    Rep Power
    496
    You did not tell us which error. And you don't provide any context.

    Is the program compiling or not? Is it crashing? Is it doing something else than what you expect?

    Well, in brief, you'll have to tell us much more if you want us to help you.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    12
    Rep Power
    0
    this is the code
    my $agent = WWW::Mechanize->new( autocheck =>1);

    my $formfiller = WWW::Mechanize::FormFiller->new();

    $agent->env_proxy();

    $agent->get('the url here');

    $agent->form_number(1) if $agent->forms and scalar @{$agent->forms};

    print $agent->content,"\n";

    $agent->form_number(1);
    { local $^W; $agent->current_form->value('name', 'value'); };

    this how I can form the first page.
    and then I use
    $agent->submit();

    it take me to another page. how can I make the 2nd page relate to the first page ?? ... to sum up. I want perl to continue formfill the 2nd page also .
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2005
    Posts
    22
    Rep Power
    0
    I haven't used the WWW::Mechanize very much. Burt what I think you might need is the combination of

    $mech->set_fields( $name => $value ... )
    $mech->follow_link(...)
    $mech->submit()

    Used set_fields to set all the fields in the form and use the follow link to plot to the next page and finally call the submit.

    ssharish2005
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    12
    Rep Power
    0
    Originally Posted by ssharish2005
    I haven't used the WWW::Mechanize very much. Burt what I think you might need is the combination of

    $mech->set_fields( $name => $value ... )
    $mech->follow_link(...)
    $mech->submit()

    Used set_fields to set all the fields in the form and use the follow link to plot to the next page and finally call the submit.

    ssharish2005
    So you mean I use $mech->set_fields( $name => $value )
    to choose the value .. insteat of type???

    okay ... what about $mech->follow_link(....) I can't understand I have two links one for the home link and when I click submit it takes me to another form to fill with a new link . how will it be?
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2005
    Posts
    22
    Rep Power
    0
    Well it all depends on how the page looks like. It difficult to navigate through unless I see the html that page. Basically you use the set_field to give it a values for all the field and you fetch the link to go to and navigate yourself to that page. I'm not sure how the webpage your trying to access has been designed.

    Where is the submit button located? Is it in the same page or else where?

    ssharish2005
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    12
    Rep Power
    0
    <br /><input name="uid" type="hidden" value="13642771000" />
    <div id="donate_subm">
    <input type="image" name="imageField" id="submitbutton" src="donate_btn_sub.jpg" width="136" height="32" onclick="$('#donate_form').submit(); $('#submitbutton').hide(); $('#submittext').show();" />
    <span style="color:#C00; display:none" id="submittext">Sending Donation... <img src="images/ajax.gif" width="16" height="16" /></span>
    </div>
    </form>

    How to hit submit on this form ... I use mechanize:formfiller and when i use $agent->submit(); it make something wrong .. wrong button.

IMN logo majestic logo threadwatch logo seochat tools logo