Post query to a CGI : Socket « Network « Perl

Home
Perl
1.Array
2.CGI
3.Class
4.Data Type
5.Database
6.File
7.GUI
8.Hash
9.Language Basics
10.Network
11.Regular Expression
12.Report
13.Statement
14.String
15.Subroutine
16.System Functions
17.Win32
18.XML
Perl » Network » Socket 




Post query to a CGI
    

use IO::Socket;

$socket = IO::Socket::INET->new
(
    Proto     => "tcp",
    PeerAddr  => "reference.perl.com",
    PeerPort  => 80,
);
$socket->autoflush(1);
print $socket "GET /query.cgi?cgi HTTP/1.0\015\012\015\012";
open FILEHANDLE, ">local.html";
while (<$socket>) {
    print FILEHANDLE;
}
close FILEHANDLE;
close $socket;

   
    
    
    
  














Related examples in the same category
1.Time Server with Socket
2.Using Socket to call a Perl CGI
3.Socket server
4.Perl Modules for Networking with Sockets
5.Open a socket
6.Query a Perl CGI
7.Listen to a port
8.Using regular expresion to validate an IP address
9.Child handle and parent handle
10.Daytime client, using symbolic host and service names
11.Add a host, delete a host, add a user, delete a user, ping a host, list processes, list filesystems, lists hosts, and kill a process.
12.A Perl TCP server without the Socket module.
13.A Simple script to update your host/ip with dyndns.org service.
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.