File: http-get.xml

package info (click to toggle)
php-doc 20061001-1
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k
  • size: 45,764 kB
  • ctags: 1,611
  • sloc: xml: 502,485; php: 7,645; cpp: 500; makefile: 297; perl: 161; sh: 141; awk: 28
file content (375 lines) | stat: -rw-r--r-- 11,744 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- Generated by xml_proto.php v2.4. Found in /scripts directory of phpdoc. -->
<refentry id="function.http-get">
 <refnamediv>
  <refname>http_get</refname>
  <refpurpose>Perform GET request</refpurpose>
 </refnamediv>
 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>string</type><methodname>http_get</methodname>
   <methodparam choice="opt"><type>string</type><parameter>url</parameter></methodparam>
   <methodparam choice="opt"><type>array</type><parameter>options</parameter></methodparam>
   <methodparam choice="opt"><type>array</type><parameter role="reference">info</parameter></methodparam>
  </methodsynopsis>
  <para>
   Performs an HTTP GET request on the supplied url.
  </para>
  <para>
   The second parameter, if set, is expected to be an associative
   array where the following options will be recognized:
  </para>
  <para id="http.request.options">
   <table>
    <title>HTTP request options</title>
    <tgroup cols="3">
     <thead>
      <row>
       <entry>Name</entry>
       <entry>Type</entry>
       <entry>Description</entry>
      </row>
     </thead>
     <tbody>
      <row>
       <entry>redirect</entry><entry>int</entry><entry>whether and how many redirects to follow</entry>
      </row>
      <row>
       <entry>unrestrictedauth</entry><entry>bool</entry><entry>whether to continue sending credentials on redirects to a different host</entry>
      </row>
      <row>
       <entry>proxyhost</entry><entry>string</entry><entry>proxy host in &quot;host[:port]&quot; format</entry>
      </row>
      <row>
       <entry>proxyport</entry><entry>int</entry><entry>use another proxy port as specified in proxyhost</entry>
      </row>
      <row>
       <entry>proxytype</entry><entry>int</entry><entry><constant>HTTP_PROXY_HTTP</constant>, <constant>HTTP_PROXY_SOCKS4</constant> or <constant>HTTP_PROXY_SOCKS5</constant></entry>
      </row>
      <row>
       <entry>proxyauth</entry><entry>string</entry><entry>proxy credentials in &quot;user:pass&quot; format</entry>
      </row>
      <row>
       <entry>proxyauthtype</entry><entry>int</entry><entry><constant>HTTP_AUTH_BASIC</constant> and/or <constant>HTTP_AUTH_NTLM</constant></entry>
      </row>
      <row>
       <entry>httpauth</entry><entry>string</entry><entry>http credentials in &quot;user:pass&quot; format</entry>
      </row>
      <row>
       <entry>httpauthtype</entry><entry>int</entry><entry><constant>HTTP_AUTH_BASIC</constant>, <constant>HTTP_AUTH_DIGEST</constant> and/or <constant>HTTP_AUTH_NTLM</constant></entry>
      </row>
      <row>
       <entry>compress</entry><entry>bool</entry><entry>whether to allow gzip/deflate content encoding</entry>
      </row>
      <row>
       <entry>port</entry><entry>int</entry><entry>use another port as specified in the url</entry>
      </row>
      <row>
       <entry>referer</entry><entry>string</entry><entry>the referer to send</entry>
      </row>
      <row>
       <entry>useragent</entry><entry>string</entry><entry>the user agent to send (defaults to PECL::HTTP/version (PHP/version))</entry>
      </row>
      <row>
       <entry>headers</entry><entry>array</entry><entry>list of custom headers as associative array like array(&quot;header&quot; => &quot;value&quot;)</entry>
      </row>
      <row>
       <entry>cookies</entry><entry>array</entry><entry>list of cookies as associative array like array(&quot;cookie&quot; => &quot;value&quot;)</entry>
      </row>
      <row>
       <entry>encodecookies</entry><entry>bool</entry><entry>whether to urlencode the cookies (default: true)</entry>
      </row>
      <row>
       <entry>cookiestore</entry><entry>string</entry><entry>path to a file where cookies are/will be stored</entry>
      </row>
      <row>
       <entry>cookiesession</entry><entry>bool</entry><entry>don't load session cookies from cookiestore if TRUE</entry>
      </row>
      <row>
       <entry>resume</entry><entry>int</entry><entry>byte offset to start the download from; if the server supports ranges</entry>
      </row>
      <row>
       <entry>range</entry><entry>array</entry><entry>array of arrays, each containing two integers, specifying the ranges to download if server support is given; only recognized if the resume option is empty</entry>
      </row>
      <row>
       <entry>maxfilesize</entry><entry>int</entry><entry>maximum file size that should be downloaded; has no effect, if the size of the requested entity is</entry>
      </row>
      <row>
       <entry>lastmodified</entry><entry>int</entry><entry>timestamp for If-(Un)Modified-Since header</entry>
      </row>
      <row>
       <entry>etag</entry><entry>string</entry><entry>quoted etag for If-(None-)Match header</entry>
      </row>
      <row>
       <entry>timeout</entry><entry>int</entry><entry>seconds the request may take</entry>
      </row>
      <row>
       <entry>connecttimeout</entry><entry>int</entry><entry>seconds the connect may take</entry>
      </row>
      <row>
       <entry>onprogress</entry><entry>mixed</entry><entry>progress callback</entry>
      </row>
      <row>
       <entry>interface</entry><entry>string</entry><entry>outgoing network interface (ifname, ip or hostname)</entry>
      </row>
      <row>
       <entry>portrange</entry><entry>array</entry><entry>2 integers specifying outgoing portrange to try</entry>
      </row>
      <row>
       <entry>ssl</entry><entry>array</entry>
       <entry>
        <para>
         <table id="http.request.options.ssl">
          <title>with the following options:</title>
          <tgroup cols="3">
           <thead>
            <row>
             <entry>Name</entry>
             <entry>Type</entry>
             <entry>Description</entry>
            </row>
           </thead>
           <tbody>
            <row>
             <entry>cert</entry><entry>string</entry><entry>path to certificate</entry>
            </row>
            <row>
             <entry>certtype</entry><entry>string</entry><entry>type of certificate</entry>
            </row>
            <row>
             <entry>certpasswd</entry><entry>string</entry><entry>password for certificate</entry>
            </row>
            <row>
             <entry>key</entry><entry>string</entry><entry>path to key</entry>
            </row>
            <row>
             <entry>keytype</entry><entry>string</entry><entry>type of key</entry>
            </row>
            <row>
             <entry>keypasswd</entry><entry>string</entry><entry>pasword for key</entry>
            </row>
            <row>
             <entry>engine</entry><entry>string</entry><entry>ssl engine to use</entry>
            </row>
            <row>
             <entry>version</entry><entry>int</entry><entry>ssl version to use</entry>
            </row>
            <row>
             <entry>verifypeer</entry><entry>bool</entry><entry>whether to verify the peer</entry>
            </row>
            <row>
             <entry>verifyhost</entry><entry>bool</entry><entry>whether to verify the host</entry>
            </row>
            <row>
             <entry>cipher_list</entry><entry>string</entry><entry>list of allowed ciphers</entry>
            </row>
            <row>
             <entry>cainfo</entry><entry>string</entry><entry></entry>
            </row>
            <row>
             <entry>capath</entry><entry>string</entry><entry></entry>
            </row>
            <row>
             <entry>random_file</entry><entry>string</entry><entry></entry>
            </row>
            <row>
             <entry>egdsocket</entry><entry>string</entry><entry></entry>
            </row>
           </tbody>
          </tgroup>
         </table>
        </para>
       </entry>
      </row>
     </tbody>
    </tgroup>
   </table>
  </para>
 </refsect1>
 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>url</parameter></term>
     <listitem>
      <para>
       URL
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>options</parameter></term>
     <listitem>
      <para>
       <link linkend="http.request.options">HTTP request options</link>
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>info</parameter></term>
     <listitem id="http.request.info">
      <para>
       Will be filled with request/response information
      </para>
      <para>
       <screen>
<![CDATA[array (
  'effective_url' => 'http://www.example.com/',
  'response_code' => 302,
  'connect_code' => 0,
  'filetime' => -1,
  'total_time' => 0.212348,
  'namelookup_time' => 0.038296,
  'connect_time' => 0.104144,
  'pretransfer_time' => 0.104307,
  'starttransfer_time' => 0.212077,
  'redirect_time' => 0,
  'redirect_count' => 0,
  'size_upload' => 0,
  'size_download' => 218,
  'speed_download' => 1026,
  'speed_upload' => 0,
  'header_size' => 307,
  'request_size' => 103,
  'ssl_verifyresult' => 0,
  'ssl_engines' =>
  array (
    0 => 'dynamic',
    1 => 'cswift',
    2 => 'chil',
    3 => 'atalla',
    4 => 'nuron',
    5 => 'ubsec',
    6 => 'aep',
    7 => 'sureware',
    8 => '4758cca',
  ),
  'content_length_download' => 218,
  'content_length_upload' => 0,
  'content_type' => 'text/html',
  'httpauth_avail' => 0,
  'proxyauth_avail' => 0,
  'num_connects' => 1,
  'os_errno' => 0,
  'error' => '',
)
]]>
       </screen>
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>
 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   &returns.http.response;
  </para>
 </refsect1>

 <!-- Use when ERRORS exist
 <refsect1 role="errors">
  &reftitle.errors;
  <para>
   When does this function throw E_* level errors, or exceptions?
  </para>
 </refsect1>
 -->


 <!-- Use when a CHANGELOG exists
 <refsect1 role="changelog">
  &reftitle.changelog;
  <para>
   <informaltable>
    <tgroup cols="2">
     <thead>
      <row>
       <entry>&Version;</entry>
       <entry>&Description;</entry>
      </row>
     </thead>
     <tbody>
      <row>
       <entry>Enter the PHP version of change here</entry>
       <entry>Description of change</entry>
      </row>
     </tbody>
    </tgroup>
   </informaltable>
  </para>
 </refsect1>
 -->


 <!-- Use when examples exist
 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title>A <function>http_get</function> example</title>
    <para>
     Any text that describes the purpose of the example, or
     what goes on in the example should go here (inside the
     <example> tag, not out
    </para>
    <programlisting role="php">
<![CDATA[
<?php
if ($anexample === true) {
    echo 'Use the PEAR Coding Standards';
}
?>
]]>
    </programlisting>
    &example.outputs;
    <screen>
<![CDATA[
Use the PEAR Coding Standards
]]>
    </screen>
   </example>
  </para>
 </refsect1>
 -->


 <!-- Use when adding See Also links
 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><function></function></member>
    <member>Or <link linkend="somethingelse">something else</link></member>
   </simplelist>
  </para>
 </refsect1>
 -->


</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->