cvs: peardoc /ja/package/http http-request.xml /ja/package/http/http-request basic-auth.xml cookie.xml file-upload.xml headers.xml intro.xml
proxy-auth.xml response-eval.xml

From: Date: Sun, 03 Oct 2004 15:14:50 +0000
Subject: cvs: peardoc /ja/package/http http-request.xml /ja/package/http/http-request basic-auth.xml cookie.xml file-upload.xml headers.xml intro.xml
proxy-auth.xml response-eval.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-4931@lists.php.net to get a copy of this message
elf Sun Oct 3 11:14:50 2004 EDT Added files: /peardoc/ja/package/http http-request.xml /peardoc/ja/package/http/http-request basic-auth.xml cookie.xml file-upload.xml headers.xml intro.xml proxy-auth.xml response-eval.xml Log: o added japanese manual (thanks shimooka)

http://cvs.php.net/co.php/peardoc/ja/package/http/http-request.xml?r=1.1&p=1 Index: peardoc/ja/package/http/http-request.xml +++ peardoc/ja/package/http/http-request.xml <?xml version="1.0" encoding="utf-8" ?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.2 Maintainer: shimooka Status: ready --> <sect1 id="package.http.http-request"> <title>HTTP_Request</title> <para> このパッケージは、HTTP リクエストを実行するための簡単な方法を提供します。 GET/POST/HEAD/TRACE/PUT/DELETE、Basic認証、プロキシ、プロキシ認証、SSL、 ファイルアップロードなどをサポートします。 </para> &package.http.http-request.intro; &package.http.http-request.basic-auth; &package.http.http-request.cookie; &package.http.http-request.file-upload; &package.http.http-request.headers; &package.http.http-request.proxy-auth; &package.http.http-request.response-eval; </sect1> <!-- 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 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 --> http://cvs.php.net/co.php/peardoc/ja/package/http/http-request/basic-auth.xml?r=1.1&p=1 Index: peardoc/ja/package/http/http-request/basic-auth.xml +++ peardoc/ja/package/http/http-request/basic-auth.xml <?xml version="1.0" encoding="utf-8" ?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.1 Maintainer: shimooka Status: ready --> <refentry id="package.http.http-request.basic-auth"> <refnamediv> <refname>Basic 認証</refname> <refpurpose> 保護された Web サイトのための認証 </refpurpose> </refnamediv> <refsect1 id="package.http.http-request.basic-auth.intro"> <title>Basic 認証導入</title> <titleabbrev>導入</titleabbrev> <para> Basic 認証は、<ulink url="&url.rfc;2617">RFC 2617</ulink> で定義されたチャレンジ-レスポンスメカニズムです。 </para> </refsect1> <refsect1 id="package.http.http-request.basic-auth.usage"> <title>Basic 認証の使用方法</title> <example> <title>Basic 認証</title> <para> 以下の例は、Basic 認証で保護されたホスト <literal>example.com</literal> にあるとあるページ <filename>/protected.html</filename> を取得しようとしている、と想定しています。 認証をパスするために必要なユーザー名は <literal>johndoe</literal> で、 付随するパスワードは <literal>foo</literal> です。 </para> <programlisting role="php"> require_once "HTTP/Request.php"; $req =&amp; new HTTP_Request("http://example.com/protected.html"); $req->setBasicAuth("johndoe", "foo"); $response = $req->sendRequest(); if (PEAR::isError($response)) { echo $response->getMessage(); } else { echo $req->getResponseBody(); } </programlisting> </example> </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 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 --> http://cvs.php.net/co.php/peardoc/ja/package/http/http-request/cookie.xml?r=1.1&p=1 Index: peardoc/ja/package/http/http-request/cookie.xml +++ peardoc/ja/package/http/http-request/cookie.xml <?xml version="1.0" encoding="utf-8" ?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.2 Maintainer: shimooka Status: ready --> <refentry id="package.http.http-request.cookie"> <refnamediv> <refname>クッキー</refname> <refpurpose> <classname>HTTP_Request</classname> でクッキーを利用する </refpurpose> </refnamediv> <refsect1 id="package.http.http-request.cookie.usage.add"> <title>HTTP リクエストへのクッキーの追加方法</title> <example> <title>リクエストにクッキーを追加する</title> <para> この例では、<literal>version</literal> というクッキーが HTTP リクエストに追加されます。このクッキーの値は、 <classname>HTTP_Request</classname> インスタンスが動作している PHP インタプリタのバージョン文字列です。 </para> <programlisting role="php"> require_once "HTTP/Request.php"; $req =&amp; new HTTP_Request("http://example.com/"); $req->addCookie("version", phpversion()); $response = $req->sendRequest(); if (PEAR::isError($response)) { echo $response->getMessage(); } else { echo $req->getResponseBody(); } </programlisting> </example> <example> <title>HTTP レスポンスからクッキーを読み込む</title> <para> HTTP レスポンスのクッキーを読み込みは、以下の例で示されます。 </para> <programlisting role="php"> require_once "HTTP/Request.php"; $req =&amp; new HTTP_Request("http://example.com/"); $response = $req->sendRequest(); if (PEAR::isError($response)) { echo $response->getMessage(); } else { print_r($req->getResponseCookies()); } </programlisting> </example> </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 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 --> http://cvs.php.net/co.php/peardoc/ja/package/http/http-request/file-upload.xml?r=1.1&p=1 Index: peardoc/ja/package/http/http-request/file-upload.xml +++ peardoc/ja/package/http/http-request/file-upload.xml <?xml version="1.0" encoding="utf-8" ?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.1 Maintainer: shimooka Status: ready --> <refentry id="package.http.http-request.file-upload"> <refnamediv> <refname>ファイルアップロード</refname> <refpurpose> HTTP 経由でファイルをアップロードする </refpurpose> </refnamediv> <refsect1 id="package.http.http-request.file-upload.usage"> <title>ファイルアップロードの使用方法</title> <example> <title>PDF 文章をアップロードする</title> <para> この例では、<filename>/home/johndoe/text.pdf</filename> というファイルが リモートにあるマシン <literal>upload.example.com</literal> に <literal>johndoe-text.pdf</literal> という名前でアップロードされます。 さらに、ジョンが何かをアップロードする事を許可されていることを 保証するために、Basic 認証が使用されています。 </para> <programlisting role="php"> require_once "HTTP/Request.php"; $req =&amp; new HTTP_Request("http://upload.example.com/upload.php"); $req->setBasicAuth("johndoe", "foo"); $result = $req->addFile("johndoe-txt.pdf", "/home/johndoe/text.pdf"); if (PEAR::isError($result)) { echo $result->getMessage(); } else { $response = $req->sendRequest(); if (PEAR::isError($response)) { echo $response->getMessage(); } else { echo $req->getResponseBody(); } } </programlisting> </example> </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 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 --> http://cvs.php.net/co.php/peardoc/ja/package/http/http-request/headers.xml?r=1.1&p=1 Index: peardoc/ja/package/http/http-request/headers.xml +++ peardoc/ja/package/http/http-request/headers.xml <?xml version="1.0" encoding="utf-8" ?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.1 Maintainer: shimooka Status: ready --> <refentry id="package.http.http-request.headers"> <refnamediv> <refname>リクエストヘッダ</refname> <refpurpose> HTTP リクエストに付加的なのヘッダを追加する </refpurpose> </refnamediv> <refsect1 id="package.http.http-request.headers.usage"> <title>リクエストヘッダの追加方法</title> <example> <title>カスタムリクエストヘッダの追加</title> <para> 以下の例では、HTTP ヘッダ <literal>X-PHP-Version</literal> が HTTP リクエストに追加されます。このヘッダの値は、 <classname>HTTP_Request</classname> インスタンスが動作している PHP インタプリタのバージョン文字列です。 </para> <programlisting role="php"> require_once "HTTP/Request.php"; $req =&amp; new HTTP_Request("http://example.com/"); $req->addHeader("X-PHP-Version", phpversion()); $response = $req->sendRequest(); if (PEAR::isError($response)) { echo $response->getMessage(); } else { echo $req->getResponseBody(); } </programlisting> </example> <para> <classname>HTTP_Request</classname> オブジェクトに追加されたヘッダは、 <function>sendRequest</function> がコールされる前に <function>removeHeader</function> で削除することができます。 </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 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 --> http://cvs.php.net/co.php/peardoc/ja/package/http/http-request/intro.xml?r=1.1&p=1 Index: peardoc/ja/package/http/http-request/intro.xml +++ peardoc/ja/package/http/http-request/intro.xml <?xml version="1.0" encoding="utf-8" ?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.2 Maintainer: shimooka Status: ready --> <refentry id="package.http.http-request.intro"> <refnamediv> <refname>導入</refname> <refpurpose> <classname>HTTP_Request</classname> 導入 </refpurpose> </refnamediv> <refsect1 id="package.http.http-request.intro.overview"> <title>概要</title> <para> このパッケージを使用することで、<acronym>PHP</acronym> スクリプトから HTTP リクエストを簡単に処理することができます。 これは、GET/POST/HEAD/TRACE/PUT/DELETE、Basic 認証、プロキシ、 プロキシ認証、SSL、ファイルアップロードなどをサポートしています。 </para> <para> 前述の特長のため、<classname>HTTP_Request</classname> は PHP アプリケーションで広く知られた Mozilla ブラウザのような Web ブラウザのほとんどの機能を模倣することを可能にします。 可能なアプリケーション範囲は、次の通りです: <itemizedlist> <listitem> <simpara> <function><link linkend="package.http.http-request.response-eval.codes">getResponseCode</link></function> の助けによる WWW リンクの有効性をチェックすること </simpara> </listitem> <listitem> <simpara> リモートの Web ページを取り込み、結果をパースすること </simpara> </listitem> <listitem> <simpara> その他 </simpara> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="package.http.http-request.intro.examples"> <title>いくつかの例</title> <example> <title> <ulink url="http://yahoo.com/">yahoo.com</ulink> の内容を取得し、 それを表示する </title> <programlisting role="php"> require_once "HTTP/Request.php"; $req =&amp; new HTTP_Request("http://www.yahoo.com/"); if (!PEAR::isError($req->sendRequest())) { echo $req->getResponseBody(); } </programlisting> </example> <example> <title>二つの Web サイトの内容を取得し、一行で表示する</title> <para> この例では、二つの Web サイトの内容が取得され、表示されます。 前者は POST パラメータが処理されます。POST データスタックは、 二番目の Web サイトの内容が取得される前にクリアされます。 </para> <programlisting role="php"> require_once "HTTP/Request.php"; $req =&amp; new HTTP_Request("http://www.php.net"); $req->setMethod(HTTP_REQUEST_METHOD_POST); $req->addPostData("Foo", "bar"); if (!PEAR::isError($req->sendRequest())) { $response1 = $req->getResponseBody(); } else { $response1 = ""; } $req->setMethod(HTTP_REQUEST_METHOD_GET); $req->setURL("http://pear.php.net"); $req->clearPostData(); if (!PEAR::isError($req->sendRequest())) { $response2 = $req->getResponseBody(); } else { $response2 = ""; } echo $response1; echo $response2; </programlisting> </example> </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 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 --> http://cvs.php.net/co.php/peardoc/ja/package/http/http-request/proxy-auth.xml?r=1.1&p=1 Index: peardoc/ja/package/http/http-request/proxy-auth.xml +++ peardoc/ja/package/http/http-request/proxy-auth.xml <?xml version="1.0" encoding="utf-8" ?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.1 Maintainer: shimooka Status: ready --> <refentry id="package.http.http-request.proxy-auth"> <refnamediv> <refname>プロキシ認証</refname> <refpurpose> HTTP プロキシを利用する </refpurpose> </refnamediv> <refsect1 id="package.http.http-request.proxy-auth.usage"> <title>プロキシ認証の使用方法</title> <example> <title>匿名アクセスでプロキシサーバを利用する</title> <para> この例では、プロキシサーバがポート <literal>8080</literal> で待機しており、 example.com への外向き接続の代理(プロキシ)を行っている <literal>proxy.example.com</literal> というホスト名のマシンを 利用しようとしている、と想定しています。 </para> <para> <function>setProxy</function> の二番目のパラメータはオプションで、 デフォルトは <literal>8080</literal> です。 </para> <programlisting role="php"> require_once "HTTP/Request.php"; $req =&amp; new HTTP_Request("http://example.com/"); $req->setProxy("proxy.example.com", 8080); </programlisting> </example> <example> <title>プロキシ認証の利用</title> <para> これは、プロキシサーバでのユーザー認証のためのユーザー名/パスワードの タプルが提供されていることを除いて、上記と同じ例です: ユーザー名は <literal>johndoe</literal> で付随するパスワードは <literal>foo</literal> です。 </para> <programlisting role="php"> require_once "HTTP/Request.php"; $req =&amp; new HTTP_Request("http://example.com/"); $req->setProxy("proxy.example.com", 8080, "johndoe", "foo"); </programlisting> </example> </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 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 --> http://cvs.php.net/co.php/peardoc/ja/package/http/http-request/response-eval.xml?r=1.1&p=1 Index: peardoc/ja/package/http/http-request/response-eval.xml +++ peardoc/ja/package/http/http-request/response-eval.xml <?xml version="1.0" encoding="utf-8" ?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.1 Maintainer: shimooka Status: ready --> <refentry id="package.http.http-request.response-eval"> <refnamediv> <refname>レスポンスの評価</refname> <refpurpose> HTTP レスポンスからの情報を評価する </refpurpose> </refnamediv> <refsect1 id="package.http.http-request.response-eval.intro"> <title>導入</title> <para> HTTP は <emphasis>Request - Response</emphasis> スキームに基づいたプロトコルなので、 全ての HTTP リクエストは HTTP レスポンスに追随されます。 <classname>HTTP_Request</classname> は、 それらのレスポンスからの情報を評価するいくつかのメソッドを提供しています。 </para> </refsect1> <refsect1 id="package.http.http-request.response-eval.codes"> <title>レスポンスコード</title> <para> HTTP レスポンスの重要な部分は、レスポンスコードです。 最も良く知られたレスポンスコードは、 おそらく何度かブラウザで見たことがある <literal>404</literal> でしょう。 <literal>404</literal> の意味は、 リクエストされたリソースを見つけることができなかった、ということです。 ステータスコードの完全なリストは、 <ulink url="&url.rfc;2616">RFC 2616</ulink> に見つけることができます。 </para> <example> <title>レスポンスコードをチェックする</title> <programlisting role="php"> require_once "HTTP/Request.php"; $urls = array( "http://www.example.com/", "http://example.com/thisdoesnotexist.html" ); $req =&amp; new HTTP_Request(""); foreach ($urls as $url) { $req->setURL($url); $req->sendRequest(); $code = $req->getResponseCode(); switch ($code) { case 404: echo "Document not found\n"; break; case 200: echo "Everything's ok\n"; break; /* ... */ } } </programlisting> </example> </refsect1> <refsect1 id="package.http.http-request.response-eval.header"> <title>レスポンスヘッダ</title> <para> HTTP リクエストと同様、HTTP レスポンスはヘッダとボディで構成されます。 <classname>HTTP_Request</classname> は、 レスポンスヘッダにアクセスするためのメソッドを提供します。 </para> <example> <title>レスポンスからの全てのヘッダを取得する</title> <programlisting role="php"> require_once "HTTP/Request.php"; $req =&amp; new HTTP_Request("http://example.com/"); $req->sendRequest(); foreach ($req->getResponseHeader() as $name => $value) { echo $name . " = " . $value . "\n"; } </programlisting> <para> これは、全てのヘッダと付随する値を表示します。 </para> </example> <example> <title>特定のヘッダを取得する</title> <programlisting role="php"> require_once "HTTP/Request.php"; $req =&amp; new HTTP_Request("http://example.com/"); $req->sendRequest(); echo $req->getResponseHeader("Date"); </programlisting> <para> これは、<literal>Date:</literal> ヘッダの値を表示します。 </para> </example> </refsect1> <refsect1 id="package.http.http-request.response-eval.cookies"> <title>クッキーのレスポンス</title> <para> HTTP レスポンスの一部であるクッキーを取得については、 <link linkend="package.http.http-request.cookie">Cookies</link> に記載されています。 </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 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 -->
« previous php.pear.doc (#4931) next »