1 | NAME |
1 | NAME |
2 | AnyEvent::HTTP - simple but non-blocking HTTP/HTTPS client |
2 | AnyEvent::HTTP - simple but non-blocking HTTP/HTTPS client |
3 | |
3 | |
4 | SYNOPSIS |
4 | SYNOPSIS |
5 | use AnyEvent::HTTP; |
5 | use AnyEvent::HTTP; |
|
|
6 | |
|
|
7 | http_get "http://www.nethype.de/", sub { print $_[1] }; |
|
|
8 | |
|
|
9 | # ... do something else here |
6 | |
10 | |
7 | DESCRIPTION |
11 | DESCRIPTION |
8 | This module is an AnyEvent user, you need to make sure that you use and |
12 | This module is an AnyEvent user, you need to make sure that you use and |
9 | run a supported event loop. |
13 | run a supported event loop. |
10 | |
14 | |
… | |
… | |
43 | The callback will be called with the response data as first argument |
47 | The callback will be called with the response data as first argument |
44 | (or "undef" if it wasn't available due to errors), and a hash-ref |
48 | (or "undef" if it wasn't available due to errors), and a hash-ref |
45 | with response headers as second argument. |
49 | with response headers as second argument. |
46 | |
50 | |
47 | All the headers in that hash are lowercased. In addition to the |
51 | All the headers in that hash are lowercased. In addition to the |
48 | response headers, the three "pseudo-headers" "HTTPVersion", "Status" |
52 | response headers, the "pseudo-headers" "HTTPVersion", "Status" and |
49 | and "Reason" contain the three parts of the HTTP Status-Line of the |
53 | "Reason" contain the three parts of the HTTP Status-Line of the same |
|
|
54 | name. The pseudo-header "URL" contains the original URL (which can |
|
|
55 | differ from the requested URL when following redirects). |
|
|
56 | |
50 | same name. If the server sends a header multiple lines, then their |
57 | If the server sends a header multiple lines, then their contents |
51 | contents will be joined together with "\x00". |
58 | will be joined together with "\x00". |
52 | |
59 | |
53 | If an internal error occurs, such as not being able to resolve a |
60 | If an internal error occurs, such as not being able to resolve a |
54 | hostname, then $data will be "undef", "$headers->{Status}" will be |
61 | hostname, then $data will be "undef", "$headers->{Status}" will be |
55 | 599 and the "Reason" pseudo-header will contain an error message. |
62 | 599 and the "Reason" pseudo-header will contain an error message. |
56 | |
63 | |
… | |
… | |
166 | |
173 | |
167 | SEE ALSO |
174 | SEE ALSO |
168 | AnyEvent. |
175 | AnyEvent. |
169 | |
176 | |
170 | AUTHOR |
177 | AUTHOR |
171 | Marc Lehmann <schmorp@schmorp.de> |
178 | Marc Lehmann <schmorp@schmorp.de> |
172 | http://home.schmorp.de/ |
179 | http://home.schmorp.de/ |
173 | |
180 | |