File: url.xml

package info (click to toggle)
phpdoc 20020310-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 35,272 kB
  • ctags: 354
  • sloc: xml: 799,767; php: 1,395; cpp: 500; makefile: 200; sh: 140; awk: 51
file content (261 lines) | stat: -rw-r--r-- 9,321 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
<?xml version="1.0" encoding="utf-8"?>
 <reference id="ref.url">
  <title>URL Functions</title>
  <titleabbrev>URLs</titleabbrev>

  <refentry id="function.base64-decode">
   <refnamediv>
    <refname>base64_decode</refname>
    <refpurpose>Decodes data encoded with MIME base64</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>string</type><methodname>base64_decode</methodname>
      <methodparam><type>string</type><parameter>encoded_data</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>base64_decode</function> decodes
     <parameter>encoded_data</parameter> and returns the original
     data.  The returned data may be binary.
    </para>
    <para>
     See also: <function>base64_encode</function>, RFC-2045 section
     6.8.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.base64-encode">
   <refnamediv>
    <refname>base64_encode</refname>
    <refpurpose>Encodes data with MIME base64</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>string</type><methodname>base64_encode</methodname>
      <methodparam><type>string</type><parameter>data</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>base64_encode</function> returns
     <parameter>data</parameter> encoded with base64.  This encoding
     is designed to make binary data survive transport through
     transport layers that are not 8-bit clean, such as mail bodies.
    </para>
    <para>
     Base64-encoded data takes about 33% more space than the original
     data.</para>
    <para>
     See also:
     <function>base64_decode</function>,
     <function>chunk_split</function>,
     RFC-2045 section 6.8.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.parse-url">
   <refnamediv>
    <refname>parse_url</refname>
    <refpurpose>Parse a URL and return its components</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>array</type><methodname>parse_url</methodname>
      <methodparam><type>string</type><parameter>url</parameter></methodparam>
     </methodsynopsis>
    <para>
     This function returns an associative array returning any of the
     various components of the URL that are present. This includes the
     "scheme", "host", "port", "user", "pass", "path", "query", and
     "fragment".
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.rawurldecode">
   <refnamediv>
    <refname>rawurldecode</refname>
    <refpurpose>Decode URL-encoded strings</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>string</type><methodname>rawurldecode</methodname>
      <methodparam><type>string</type><parameter>str</parameter></methodparam>
     </methodsynopsis>
    <para>
     Returns a string in which the sequences with percent
     (<literal>%</literal>) signs followed by two hex digits have been
     replaced with literal characters.  For example, the string
     <screen>foo%20bar%40baz</screen> decodes into <screen>foo
     bar@baz</screen>.
    </para>
    <simpara>
     See also <function>rawurlencode</function>,
		          <function>urldecode</function>,
							<function>urlencode</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.rawurlencode">
   <refnamediv>
    <refname>rawurlencode</refname>
    <refpurpose>URL-encode according to RFC1738</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>string</type><methodname>rawurlencode</methodname>
      <methodparam><type>string</type><parameter>str</parameter></methodparam>
     </methodsynopsis>
    <para>
     Returns a string in which all non-alphanumeric characters except
     <screen>-_.</screen> have been replaced with a percent
     (<literal>%</literal>) sign followed by two hex digits.  This is
     the encoding described in RFC1738 for protecting literal
     characters from being interpreted as special URL delimiters, and
     for protecting URL's from being mangled by transmission media
     with character conversions (like some email systems).  For
     example, if you want to include a password in an ftp url:
     <example>
      <title><function>rawurlencode</function> example 1</title>
      <programlisting role="php">
echo '&lt;A HREF="ftp://user:', rawurlencode ('foo @+%/'),
     '@ftp.my.com/x.txt">';
      </programlisting>
     </example>
     Or, if you pass information in a path info component of the url:
     <example>
      <title><function>rawurlencode</function> example 2</title>
      <programlisting role="php">
echo '&lt;A HREF="http://x.com/department_list_script/',
    rawurlencode ('sales and marketing/Miami'), '">';
      </programlisting>
     </example>
    </para>
    <simpara>
     See also <function>rawurldecode</function>,
		          <function>urldecode</function>,
							<function>urlencode</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.urldecode">
   <refnamediv>
    <refname>urldecode</refname>
    <refpurpose>Decodes URL-encoded string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>string</type><methodname>urldecode</methodname>
      <methodparam><type>string</type><parameter>str</parameter></methodparam>
     </methodsynopsis>
    <para>
     Decodes any <literal>%<replaceable>##</replaceable></literal>
     encoding in the given string.  The decoded string is returned.
     <example>
      <title><function>urldecode</function> example</title>
      <programlisting role="php">
$a = split ('&amp;', $querystring);
$i = 0;
while ($i &lt; count ($a)) {
    $b = split ('=', $a [$i]);
    echo 'Value for parameter ', htmlspecialchars (urldecode ($b [0])),
         ' is ', htmlspecialchars (urldecode ($b [1])), "&lt;BR>";
    $i++;
}
      </programlisting>
     </example>
    </para>
    <para>
     See also <function>urlencode</function>,
		          <function>rawurlencode</function>,
							<function>rawurldecode</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.urlencode">
   <refnamediv>
    <refname>urlencode</refname>
    <refpurpose>URL-encodes string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>string</type><methodname>urlencode</methodname>
      <methodparam><type>string</type><parameter>str</parameter></methodparam>
     </methodsynopsis>
    <para>
     Returns a string in which all non-alphanumeric characters except
     <literal>-_.</literal> have been replaced with a percent
     (<literal>%</literal>) sign followed by two hex digits and spaces
     encoded as plus (<literal>+</literal>) signs.  It is encoded the
     same way that the posted data from a WWW form is encoded, that is
     the same way as in
     <literal>application/x-www-form-urlencoded</literal> media type.
     This differs from the RFC1738 encoding (see
     <function>rawurlencode</function>) in that for historical
     reasons, spaces are encoded as plus (+) signs.  This function is
     convenient when encoding a string to be used in a query part of
     an URL, as a convenient way to pass variables to the next page:
     <example>
      <title><function>urlencode</function> example</title>
      <programlisting role="php">
echo '&lt;A HREF="mycgi?foo=', urlencode ($userinput), '"&gt;';
      </programlisting>
     </example>
    </para>
	<para>Note: Be careful about variables that may match HTML entities.  
	Things like &amp;amp, &amp;copy and &amp;pound are parsed by the browser
	and the actual entity is used instead of the desired variable name.  This 
	is an obvious hassle that the W3C has been telling people about for years.
	The reference is here: <ulink url="&url.argsep;">&url.argsep;</ulink>
	PHP supports changing the argument separator to the W3C-suggested
	semi-colon through the arg_separator .ini directive.  Unfortunately most
	user agents do not send form data in this semi-colon separated format.
	A more portable way around this is to use &amp;amp; instead of &amp; as the
    separator.  You don't need to change PHP's arg_separator for this.  Leave
	it as &amp;, but simply encode your URLs using <function>htmlentities</function>(urlencode($data)).
     <example>
      <title><function>urlencode/htmlentities</function> example</title>
      <programlisting role="php">
echo '&lt;A HREF="mycgi?foo=', htmlentities (urlencode ($userinput) ), '"&gt;';
      </programlisting>
     </example>
	</para>
    <para>
     See also <function>urldecode</function>,
		          <function>htmlentities</function>,
		          <function>rawurldecode</function>,
							<function>rawurlencode</function>.
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- 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:
-->