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.