tailieunhanh - Web Client Programming with Perl-Chapter 4: The Socket Library- P2

Tham khảo tài liệu 'web client programming with perl-chapter 4: the socket library- p2', công nghệ thông tin, quản trị web phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Chapter 4 The Socket Library- P2 Now we wait for a response from the server. We read in the response and selectively echo it out where we look at the response header and data variables to see if the user is interested in looking at each part of the reply get the HTTP response line my the_response F print the_response if all defined response get the header data while F m A S s . print 1 2 n if all defined header get the entity body if all defined data print while F The full source code looks like this usr local bin perl -w socket based hypertext version of UNIX cat use strict use Socket module require routine require routine include Socket file with Open_TCP file with parseURL use vars qw opt_h opt_H opt_r opt_d use Getopt Std parse command line arguments getopts hHrd print out usage if needed if defined opt_h ARGV 0 help if it wasn t an option it was a URL while _ shift @ARGV hcat _ opt_r opt_H opt_d Subroutine to print out usage information sub usage print usage 0 -rhHd URL s n

TỪ KHÓA LIÊN QUAN