mirror of
https://github.com/php/doc-ru.git
synced 2026-03-24 07:42:22 +01:00
* Update examples.xml to en * Update construct.xml to en * Update curl-copy-handle.xml to En * Update curl-errno.xml to en * Update curl-error.xml to en * Update curl-escape.xml to en * Update curl-copy-handle.xml * Update curl-copy-handle.xml * Update curl-copy-handle.xml * Update curl-exec.xml to en * Update curl-getinfo.xml to en * Update curl-multi-close.xml to en * Update curl-reset.xml to en * Update curl-setopt-array.xml to en * Update curl-setopt.xml to en * Update curl-share-close.xml to en * Update curl-share-close.xml Исправил XML-разметку * Update curl-share-close.xml Исправил формулировку Дело ведь не только в доступности данных cookies первого easy-дескриптора второму, а оба дескриптора настроили на работу с общим хранилищем данных cookies, которым управляет shared-дескриптор * Update curl-share-init.xml to en * Update curl-strerror.xml to en * Update curl-escape.xml Состав → структуру * Update curl-escape.xml Состав → структура * Update curl-unescape.xml to en * Update curl-upkeep.xml to en
64 lines
2.2 KiB
XML
64 lines
2.2 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
||
<!-- EN-Revision: fc9a0a8b29a7a099998bdd71fe5350a10b18fe62 Maintainer: shein Status: ready -->
|
||
<!-- Reviewed: no -->
|
||
|
||
<chapter xml:id="curl.examples" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||
&reftitle.examples;
|
||
<section xml:id="curl.examples-basic">
|
||
<title>Пример работы с модулем curl</title>
|
||
<para>
|
||
Функции модуля cURL становятся доступны для вызова сразу после сборки PHP
|
||
с поддержкой cURL. Работа с модулем cURL начинается
|
||
с инициализации сеанса сетевого обмена данными вызовом функции <function>curl_init</function>.
|
||
Затем функцией <function>curl_setopt</function> устанавливают параметры сетевой передачи
|
||
и выполняют сеанс обмена данными путём вызова функции <function>curl_exec</function>.
|
||
Следующий пример получает начальную страницу сайта example.com
|
||
функциями модуля cURL и сохраняет результат в файл:
|
||
<example>
|
||
<title>Загрузка стартовой страницы сайта example.com функциями PHP-модуля cURL</title>
|
||
<programlisting role="php">
|
||
<![CDATA[
|
||
<?php
|
||
|
||
$ch = curl_init("http://www.example.com/");
|
||
$fp = fopen("example_homepage.txt", "w");
|
||
|
||
curl_setopt($ch, CURLOPT_FILE, $fp);
|
||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||
|
||
curl_exec($ch);
|
||
if (curl_error($ch)) {
|
||
fwrite($fp, curl_error($ch));
|
||
}
|
||
|
||
fclose($fp);
|
||
|
||
?>
|
||
]]>
|
||
</programlisting>
|
||
</example>
|
||
</para>
|
||
</section>
|
||
|
||
</chapter>
|
||
<!-- 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
|
||
-->
|