in reply to LWP hit button to continue

LWP doesn't hit buttons - it just fetches the page and leaves it up to you to parse and process it.

But, of course, others have done the heavy lifting for you: Check out WWW::Mechanize, which is built on top of LWP, and has a click method to simulate clicking the button.

Replies are listed 'Best First'.
Re^2: LWP hit button to continue
by Anonymous Monk on Mar 23, 2021 at 15:44 UTC
    Actually it is a button to agree to be over 18, so knowing the next link is no use. Some sort of permission from the site seems to be required.
      I can't help you there: I don't even know whether you are over 18 :)
Re^2: LWP hit button to continue
by Anonymous Monk on Mar 23, 2021 at 15:38 UTC
    Yes, I have been there, but being a beginner I did not understand how to get that working.
    Would it be possible to give a code that would work on the given example?

      It's actually not that hard. I missed in your example HTML that the button is just "decoration" for the a element (which is missing a closing quote after https://something), so you don't need to "click" a button, you need to follow a link.

      Note that $url should be provided by someone.

      use WWW::Mechanize; $ua = WWW::Mechanize->new; my $response = $ua->get($url); my $next_response = $ua->follow_link(text_regex => qr/continue.../);

      I missed in your example that the button is just "decoration" for the a element (which is missing a closing quote after https://something), so you don't need to "click" a button, you need to follow a link.

        Like I said: I know the next link, but I can only get there after hitting the button. Otherwise I am redirected back to the page I am already on.