[Libwww-perl] -- use of the post method, libwww-perlpost

Source: Internet
Author: User

[Libwww-perl] -- use of the post method, libwww-perlpost

Libwww-perl is a tool I met when learning varnish.

For details about what libwww-perl is, refer to https://github.com/libwww-perl/libwww-perl.

README has a detailed explanation.

 

This article does not describe how to use this lib in detail, but records the problems encountered when using the POST method and the corresponding solutions (Memo ).

 

Problem

After you enter POST-Use http: // 192.168.0.101/signin, you need to enter the post parameter and value. However, after the input, click "enter" and other operations cannot be continued.

Only Ctrl + C can exit the program, but it cannot get the desired execution result.

 

Solution

Step 1: search for information about libwww-perl and POST on the Internet.

However, I did not find a solution (or I did not search carefully), but I got some useful information:

1. libwww-perl is written in perl;

2. Source Code address https://github.com/libwww-perl/libwww-perl

3. The POST method belongs to the lwp-request module.

 

Step 2: if you cannot find a solution, use the above information to find the solution.

1. First, obtain the source code of the POST method based on the 2 and 3 in step 1 and the output displayed when the POST method is run.

In the https://github.com/libwww-perl/libwww-perl/blob/master/bin/lwp-requestfile

    print STDERR "Please enter content ($options{'c'}) to be ${method}ed:\n"        if -t;    binmode STDIN unless -t or $options{'a'};    $content = join("", <STDIN>);

2. I learned from the above that it was originally stuck on the STDIN of perl. The problem becomes: I don't know how to exit the STDIN of perl program.

3. Continue the online search. The original Ctrl + D and Ctrl + Z can exit the STDIN of the perl Program (do not understand the perl language .)

 

Step 3: continue with your work.

 

Summary

The entire problem is ultimately caused by a small knowledge point. This is really impossible and I have learned less.

But through this question, I learned about the libwww-perl tool and some knowledge points of perl, and I feel very good.


Perl uploads large binary files in post mode. memory overflow error occurs. How can this problem be solved?
How does perl submit https post?

Now, you want to use perl to simulate http logon. However, after submitting a website, you will jump to an https sso address for verification after entering the user name and password. After the verification is complete, the website will return a non-http page. The sso address has been found using firebug, but when using perl to simulate post submission, it always reports

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.