Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 611697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:48:45+00:00 2026-05-13T17:48:45+00:00

Is there a way in WWW::Mechanize or any Perl module to read on a

  • 0

Is there a way in WWW::Mechanize or any Perl module to read on a file after accessing a website. For example, I clicked a button ‘Receive’, and a file (.txt) will appear containing a message. How will I be able to read the content? Answers are very much appreciated.. I’ve been working on this for days,, Also, I tried all the possibilities. Can anyone help? If you can give me an idea please? 🙂

Here is a part of my code:

…

my $username = "admin";<br>
my $password = "12345";<br>

my $url = "http://...do_gsm_sms.cgi";

my $mech = WWW::Mechanize->new(autocheck => 1, quiet => 0, agent_alias =>$login_agent, cookie_jar => $cookie_jar);

$mech->credentials($username, $password);<br>
$mech->get($url);

$mech->success() or die "Can't fetch the Requested page";<br>

print "OK! \n"; #This works <br> 

$mech->form_number(1);

$mech->click()

;

After this, ‘Downloads’ dialog box will appear so I can save the file (but I can also set the default to open it immediately instead of saving). Question is, how can I read the content of this file?

..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T17:48:45+00:00Added an answer on May 13, 2026 at 5:48 pm

    After the click (assuming that’s doing what it’s supposed to), the returned data should be stored in your $mech object. You should be able to get the file data with $mech->content(),
    perhaps after verifying success with $mech->status() and the type of response with $mech->content_type().

    You may find it helpful to remember that WWW::Mechanize replaces the browser; anything a browser would have done, like bringing up a download window and saving a file, doesn’t actually happen, but all the information the browser would have had is accessible through WWW::Mechanize’s methods.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there way that I can read the file from remote server using fopen
Is there a way to influence the encoding of the save_content() -method from WWW::Mechanize
Is there any way I can make user URLs? something like www.domain.com/username I know
Is there a way to see the tree of a website? Let's say: www.randomsite.com
Is there a way to restrict access to a specific webpage such as http://www.example.com/subpage
Is there a way to search on www.qantas.com.au or other sites that don't use
Is there a way to get the server url (ex: http://www.myapp.com:8080/applicationFolder ) without having
Is there way to get file from windows xp command prompt? I tried to
Is there way to copy a file into Plone with WebDAV and have Plone
Getting the following error in a JavaScript link using perl - WWW::Mechanize . Error

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.