cvs: peardoc /en/package/http/http head.xml
| From: | Martin Jansen | Date: | Tue, 25 Nov 2003 21:46:45 +0000 |
| Subject: | cvs: peardoc /en/package/http/http head.xml | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-2012@lists.php.net to get a copy of this message | ||
mj Tue Nov 25 16:46:45 2003 EDT
Modified files:
/peardoc/en/package/http/http head.xml
Log:
* Example for HTTP::head()
Index: peardoc/en/package/http/http/head.xml
diff -u peardoc/en/package/http/http/head.xml:1.3 peardoc/en/package/http/http/head.xml:1.4
--- peardoc/en/package/http/http/head.xml:1.3 Tue Jun 17 07:10:35 2003
+++ peardoc/en/package/http/http/head.xml Tue Nov 25 16:46:44 2003
@@ -1,4 +1,4 @@
-<!-- $Revision: 1.3 $ -->
+<!-- $Revision: 1.4 $ -->
<refentry id="package.http.http.head">
<refnamediv>
<refname>HTTP::head</refname>
@@ -22,6 +22,32 @@
in an associative array.
</para>
</refsect1>
+ <refsect1 id="package.http.http.head.example">
+ &title.example;
+ <para>
+ <example>
+ <title>HEAD request to example.com</title>
+ <programlisting role="php">
+ <![CDATA[
+require_once "PEAR.php";
+require_once "HTTP.php";
+
+$result = HTTP::head("http://example.com/");
+
+if (PEAR::isError($result)) {
+ echo "Error: " . $result->getMessage();
+} else {
+ echo "<pre>";
+ print_r($result);
+ echo "</pre>";
+}
+ ]]>
+ </programlisting>
+ </example>
+ The output of the <function>print_r</function> call is shown
+ <link linkend="package.http.http.head.return.example">below</link>.
+ </para>
+ </refsect1>
<refsect1 id="package.http.http.head.parameter">
&title.param;
<para>
@@ -40,19 +66,22 @@
<parameter>array</parameter> - an array containing the header lines
or a &class.pear-error;.
</para>
- <para>
+ <para id="package.http.http.head.return.example">
Example output:
<programlisting role="php">
<![CDATA[
Array
(
- [response_code] => 200 // The HTTP response code
- [response] => HTTP/1.1 200 OK // The full HTTP response string
- [Date] => Fri, 11 Jan 2002 01:41:44 GMT
- [Server] => Apache/1.3.20 (Unix) PHP/4.1.1
- [X-Powered-By] => PHP/4.1.1
- [Connection] => close
- [Content-Type] => text/html
+ [response_code] => 200
+ [response] => HTTP/1.1 200 OK
+ [Date] => Tue, 25 Nov 2003 22:08:57 GMT
+ [Server] => Apache/1.3.27 (Unix) (Red-Hat/Linux)
+ [Last-Modified] => Wed, 08 Jan 2003 23:11:55 GMT
+ [ETag] => "3f80f-1b6-3e1cb03b"
+ [Accept-Ranges] => bytes
+ [Content-Length] => 438
+ [Connection] => close
+ [Content-Type] => text/html
)
]]>
</programlisting>