Difference: TWikiFuncDotPm (13 vs. 14)

Revision 142012-10-07 - TWikiContributor

Line: 112 to 112
 

Changed:
<
<

getExternalResource( $url ) -> $response

>
>

getExternalResource( $url, @headers ) -> $response

  Get whatever is at the other end of a URL (using an HTTP GET request). Will only work for encrypted protocols such as https if the LWP CPAN module is installed.

Note that the $url may have an optional user and password, as specified by

Changed:
<
<
the relevant RFC. Any proxy set in configure is honoured.
>
>
the relevant RFC. Any proxy set in configure is honored.

Optional headers may be supplied of form 'name1', 'value1', 'name2', 'value2'. Do not add a User-Agent header, it will be added.

  The $response is an object that is known to implement the following subset of the methods of LWP::Response. It may in fact be an LWP::Response object,
Line: 151 to 154
 
my $response = TWiki::Func::getExternalResource($url);
if (!$response->is_error() && $response->isa('HTTP::Response')) {
Changed:
<
<
... other methods of HTTP::Response may be called
>
>
$text = $response->content(); # ... other methods of HTTP::Response may be called
 } else {
Changed:
<
<
... only the methods listed above may be called
>
>
# ... only the methods listed above may be called
 }
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 1999-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.TWikiFuncDotPm.