1
0
mirror of https://github.com/php/doc-ja.git synced 2026-03-25 23:52:16 +01:00
Files
archived-doc-ja/reference/http/HttpRequest/send.xml
TAKAGI Masahiro b5036683c6 sync with en.
git-svn-id: https://svn.php.net/repository/phpdoc/ja/trunk@322304 c90b9560-bf6c-de11-be94-00142212c4b1
2012-01-15 00:01:10 +00:00

151 lines
3.7 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 196abbabb4f94cc5e9de0ace42e121e5fdb4de7f Maintainer: takagi Status: ready -->
<refentry xml:id="httprequest.send" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>HttpRequest::send</refname>
<refpurpose>リクエストを送信する</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier>
<type>HttpMessage</type><methodname>HttpRequest::send</methodname>
<void/>
</methodsynopsis>
<para>
HTTP リクエストを送信します。
</para>
<note>
<para>
例外がスローされた場合でも、少なくとも部分的には転送に成功しているかもしれません。
そこで、さまざまな <classname>HttpRequest</classname>::getResponse*() メソッドを使用して
返り値を調べるようにしましょう。
</para>
</note>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
受信したレスポンスを <classname>HttpMessage</classname> オブジェクトとして返します。
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
<para>
<classname>HttpRuntimeException</classname><classname>HttpRequestException</classname>
<classname>HttpMalformedHeaderException</classname><classname>HttpEncodingException</classname>
をスローします。
</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>
-->
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>GET example</title>
<programlisting role="php">
<![CDATA[
<?php
$r = new HttpRequest('http://example.com/feed.rss', HttpRequest::METH_GET);
$r->setOptions(array('lastmodified' => filemtime('local.rss')));
$r->addQueryData(array('category' => 3));
try {
$r->send();
if ($r->getResponseCode() == 200) {
file_put_contents('local.rss', $r->getResponseBody());
}
} catch (HttpException $ex) {
echo $ex;
}
?>
]]>
</programlisting>
</example>
<example>
<title>POST example</title>
<programlisting role="php">
<![CDATA[
<?php
$r = new HttpRequest('http://example.com/form.php', HttpRequest::METH_POST);
$r->setOptions(array('cookies' => array('lang' => 'de')));
$r->addPostFields(array('user' => 'mike', 'pass' => 's3c|r3t'));
$r->addPostFile('image', 'profile.jpg', 'image/jpeg');
try {
echo $r->send()->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
]]>
</programlisting>
</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:"~/.phpdoc/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
-->