[Cover] [Previous Section] [Next Section] [Index]
Current chapter: Perl HTTP Utilities
Section 67 out of 79 total sections
, Section 4 out of 5 sections in this chapter
HTTPConnectAndBuffer()
Description
Retrieves the content of a URL and stores it in a specified buffer. HTTPConnectAndBuffer() handles up to five redirects. If it doesn't load the specified URL after the fifth redirect, it fails, returning 0. HTTPConnectAndBuffer() treats the specified buffer as a scalar array. It stores each line of the retrieved content to a separate array member. As an option, you can specify the method of the request, GET or POST. If the method is POST, the last parameter is the content to send to the server. If you do not specify a method, GET is assumed.
Synopsis
require 'HTTPClient.pl';
...
&AppUtils::HTTPConnectAndBuffer($url, $pageRef, $method,
$postArgs);
Arguments
|
Argument
|
Meaning
|
$url
|
The URL to use, of the form http://[host[:port]]/[path].
|
$pageRef
|
Reference to an array to store the response (with headers).
|
$method
|
The request method; to use POST, specify "POST".
|
$postArgs
|
Arguments for the POST method.
|
Returns
|
Value
|
Meaning
|
0
|
Failure.
|
1
|
Success.
|
Example
. . .
&HTTPConnectAndBuffer("http://www.netscape.com", @data);
&HTTPConnectAndBuffer("http://www.netscape.com", @data,
"POST",
$args);
. . .
[Cover] [Previous Section] [Next Section] [Index]
Current chapter: Perl HTTP Utilities
Section 67 out of 79 total sections
, Section 4 out of 5 sections in this chapter
Copyright © 1999, Unwired Planet, Inc. All rights
reserved.