Use of the lwp module in Perl

Source: Internet
Author: User
Tags perl script

I haven't posted it for a long time. Today I am posting about the common functions of the lwp module.

(1) The most important function is to view the webpage source file. We can view the webpage source file through the existing methods of Perl, and then perform proper analysis to obtain the desired result. The Perl script is as follows:

 

#! /Usr/local/bin/perl
Use cgi qw (: All );
Use lwp;

Open (aim, "> F:/SFDA source code") or die $ !;

My $ browser = lwp: useragent-> new;

 

My $ url = "http://app1.sfda.gov.cn/datasearch/schedule/search.jsp? Tableid = 43 & tablename = table43 & columnname = column464 % 2ccolumn475 & Title = % D2 % A9 % C6 % B7 % D7 % A2 % B2 % E1 % BD % F8 % B6 % C8 % B2 % E9 % D1 % af ";
My $ content = $ browser-> get ($ URL)-> content;

Print aim $ content;
Close aim;
Print header;

 

Perldoc describes it as follows:

The libwww-perl collection is a set of Perl modules which provides a simple and consistent application programming interface (API) to the world-wide web. the main focus of the library is to provide classes and functions that allow you to write WWW clients. the Library also contain modules that are of more general use and even classes that help you implement simple HTTP servers.

 

We can see the importance of lwp for Perl network programming.

Related Article

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.