How resolve this issue in perl

Discussion in 'Programming' started by dilzsaran, Jun 20, 2008.

  1. #1
    Hello,

    my perl program got this error

    "Missing base arugument at C:/perl/lib/HTTP/Response.pm line 91"

    while execute..

    #! Perl\bin\perl

    use WWW::Mechanize;
    my $mech = WWW::Mechanize->new();

    $mech->get( $url );


    $mech->follow_link( text_regex => qr/viewtopic/i );
    $mech->follow_link( url => 'http://www.google.com/index.html' );

    $mech->submit_form(
    form_number => 3,
    fields => {
    username => 'guesthere3',
    postbody => 'This is a test',
    }
    );

    $mech->submit_form(
    form_name => 'post',
    fields => { query =>
    'http://www.google.co.uk/search?hl=en&safe=off&q=intitle%3A% 22ipod%22+view+f
    orum+%22you+can+post+new+topics%22&meta=', },
    button => 'submit'
    );


    My Os : Win Xp
    Perl : 5.10.0.2

    Already installed WWW::Mechanize module.


    Can any one tell why it happen...

    My Goal : i need a program which can automatically enter some random values(given by me ) in text box and click the submit button like human more than 10000 times. on a https website.

    can any one give some ideas


    Thank you Advance...
     
    dilzsaran, Jun 20, 2008 IP
  2. azlanhussain

    azlanhussain Active Member

    Messages:
    640
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    60
    #2
    Not familiar with that Perl modules. My suggestion: use LWP::UserAgent instead. It's much more robust and stable.

    Regarding your goal, if I understand it correctly you actually want to build a bot/automater :). Are you looking at submiting to a 3rd URL or within itself (script running in the same https server). Both ways are simple and I don't see any much problem to build.

    cheers,
     
    azlanhussain, Jun 24, 2008 IP
  3. dilzsaran

    dilzsaran Well-Known Member

    Messages:
    196
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    103
    #3
    Thank You for your reply

    can you explain me how to resolve it using LWP::UserAgent

    Can you give sample program for search in google with list of keywords

    i can convert it to my https
     
    dilzsaran, Jun 25, 2008 IP
  4. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #4
    Free ebook for LWP is here:
    http://oreilly.com/openbook/webclient/
    But if all you want to do is use google search with a list of keywords, you are making it look complicated. All you have to do is use the url http://www.google.com/search?q=$keyword and process the return result. Set it up as a foreach on the list of keywords and its good to go.
     
    shallowink, Jun 25, 2008 IP
    Worthen likes this.
  5. dilzsaran

    dilzsaran Well-Known Member

    Messages:
    196
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    103
    #5
    Thank you for your reply

    i just said an example google search. for that i can easily use snoopy class.

    But really i need fetch url https (ie ssl) using cookies enabled for form post values

    for this i can't use snoopy it need curl ext to work.

    After installed curl also i got errors. thats why i prefer perl..
     
    dilzsaran, Jun 25, 2008 IP
  6. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #6
    LWP can handle cookies. I'm more familiar with LWP than Mechanize but if you are doing lots of forms, Mechanize is the route to take. Also to do SSL you will have to have this module installed: IO::Socket::SSL .
    Is the above code what you are using or just an example?

    I ask cause $url isn't defined.

    Maybe this page will help...it includes using the cookie jar.

    http://www.developer.com/lang/other/article.php/10942_3454041_2
     
    shallowink, Jun 25, 2008 IP
  7. dilzsaran

    dilzsaran Well-Known Member

    Messages:
    196
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    103
    #7
    i need a program which can go to https site using cookies and post values by form post method . it has only one text box and one submit button. regarding that i already tried with perl and and php using snoopy class.
    i can do http using snoopy class but for https it requires curl ext.
    i tried to install curl and tried to give path to snoopy. but not working..

    i used xammp for that,

    Thats it my problem can you give me idea in any language

    or please give me sample program in your fav language
     
    dilzsaran, Jun 25, 2008 IP
  8. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #8
    Ok, you need to make sure you can do HTTPS connections first.... try this code to connect to paypal

    
      use LWP 5.64;
      my $url = 'https://www.paypal.com/';   # Yes, HTTPS!
      my $browser = LWP::UserAgent->new;
      my $response = $browser->get($url);
      die "Error at $url\n ", $response->status_line, "\n Aborting"
       unless $response->is_success;
      print "Whee, it worked!  I got that ",
       $response->content_type, " document!\n";
    
    Code (markup):
     
    shallowink, Jun 25, 2008 IP
  9. dilzsaran

    dilzsaran Well-Known Member

    Messages:
    196
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    103
    #9
    Really thank you for your code i'll try that

    I'm using Win Xp so i need perl with LWP 5.64 Thats it ?

    Because i'm really very new for perl basically i'm a php programmer.

    Again thank you
     
    dilzsaran, Jun 25, 2008 IP
  10. dilzsaran

    dilzsaran Well-Known Member

    Messages:
    196
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    103
    #10
    i try your program it got worked thank you

    i got reply

    i'll try it by using cookies

    Again Thanks a lot !!!!!!!!!!!!!!!!!!!!!1
     
    dilzsaran, Jun 25, 2008 IP