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 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.38 $ -->
<reference id="ref.ftp">
<title>FTP functions</title>
<titleabbrev>FTP</titleabbrev>
<partintro>
<para>
The functions in this extension implement client access to file
servers speaking the File Transfer Protocol FTP as defined in
&spec.ftp;.
</para>
<para>
The following constants are defined when using the FTP module:
<constant>FTP_ASCII</constant> and <constant>FTP_BINARY</constant>.
</para>
<para>
In order to use FTP functions with your PHP configuration, you should
add the <link linkend="install.configure.enable-ftp">
<option>--enable-ftp</option></link> option when installing PHP 4,
and <link linkend="install.configure.with-ftp">
<option>--with-ftp</option></link> when using PHP 3.
</para>
<para>
<example>
<title><function>ftp</function> example</title>
<programlisting>
<![CDATA[
<?php
// set up basic connection
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// check connection
if ((!$conn_id) || (!$login_result)) {
echo "Ftp connection has failed!";
echo "Attempted to connect to $ftp_server for user $ftp_user_name";
die;
} else {
echo "Connected to $ftp_server, for user $ftp_user_name";
}
// upload the file
$upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY);
// check upload status
if (!$upload) {
echo "Ftp upload has failed!";
} else {
echo "Uploaded $source_file to $ftp_server as $destination_file";
}
// close the FTP stream
ftp_close($conn_id);
?>
]]>
</programlisting>
</example>
</para>
</partintro>
<refentry id="function.ftp-connect">
<refnamediv>
<refname>ftp_connect</refname>
<refpurpose>Opens up an FTP connection</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>resource</type><methodname>ftp_connect</methodname>
<methodparam><type>string</type><parameter>host</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>port</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>timeout</parameter></methodparam>
</methodsynopsis>
<para>
Returns a FTP stream on success, &false; on error.
</para>
<para>
<function>ftp_connect</function> opens up a FTP connection to the
specified <parameter>host</parameter>. The <parameter>port</parameter>
parameter specifies an alternate port to connect to. If it is
omitted or zero, then the default FTP port, 21, will be used.
</para>
<para>
The <parameter>timeout</parameter> parameter specifies the timeout for all
subsequent network operations. If omitted, the default value is 90
seconds. The timeout can be changed and queried anytime with
<function>ftp_set_option</function> and
<function>ftp_get_option</function>.
<note>
<para>
This is parameter is only available in CVS.
</para>
</note>
</para>
</refsect1>
</refentry>
<refentry id="function.ftp-login">
<refnamediv>
<refname>ftp_login</refname>
<refpurpose>Logs in an FTP connection</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>ftp_login</methodname>
<methodparam><type>resource</type><parameter>ftp_stream</parameter></methodparam>
<methodparam><type>string</type><parameter>username</parameter></methodparam>
<methodparam><type>string</type><parameter>password</parameter></methodparam>
</methodsynopsis>
<para>
Logs in the given FTP stream.
</para>
<para>
Returns &true; on success, &false; on error.
</para>
</refsect1>
</refentry>
<refentry id="function.ftp-pwd">
<refnamediv>
<refname>ftp_pwd</refname>
<refpurpose>Returns the current directory name</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>ftp_pwd</methodname>
<methodparam><type>resource</type><parameter>ftp_stream</parameter></methodparam>
</methodsynopsis>
<para>
Returns the current directory, or &false; on error.
</para>
</refsect1>
</refentry>
<refentry id="function.ftp-cdup">
<refnamediv>
<refname>ftp_cdup</refname>
<refpurpose>Changes to the parent directory</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>ftp_cdup</methodname>
<methodparam><type>resource</type><parameter>ftp_stream</parameter></methodparam>
</methodsynopsis>
<para>
Changes to the parent directory.
</para>
<para>
Returns &true; on success, &false; on error.
</para>
</refsect1>
</refentry>
<refentry id="function.ftp-chdir">
<refnamediv>
<refname>ftp_chdir</refname>
<refpurpose>Changes directories on a FTP server</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>ftp_chdir</methodname>
<methodparam><type>resource</type><parameter>ftp_stream</parameter></methodparam>
<methodparam><type>string</type><parameter>directory</parameter></methodparam>
</methodsynopsis>
<para>
Changes to the specified <parameter>directory</parameter>.
</para>
<para>
Returns &true; on success, &false; on error.</para>
</refsect1>
</refentry>
<refentry id="function.ftp-mkdir">
<refnamediv>
<refname>ftp_mkdir</refname>
<refpurpose>Creates a directory</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>ftp_mkdir</methodname>
<methodparam><type>resource</type><parameter>ftp_stream</parameter></methodparam>
<methodparam><type>string</type><parameter>directory</parameter></methodparam>
</methodsynopsis>
<para>
Creates the specified <parameter>directory</parameter>.
</para>
<para>
Returns the newly created directory name on success, &false; on error.
</para>
</refsect1>
</refentry>
<refentry id="function.ftp-rmdir">
<refnamediv>
<refname>ftp_rmdir</refname>
<refpurpose>Removes a directory</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>ftp_rmdir</methodname>
<methodparam><type>resource</type><parameter>ftp_stream</parameter></methodparam>
<methodparam><type>string</type><parameter>directory</parameter></methodparam>
</methodsynopsis>
<para>
Removes the specified <parameter>directory</parameter>.
</para>
<para>
Returns &true; on success, &false; on error.</para>
</refsect1>
</refentry>
<refentry id="function.ftp-nlist">
<refnamediv>
<refname>ftp_nlist</refname>
<refpurpose>Returns a list of files in the given directory.</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>ftp_nlist</methodname>
<methodparam><type>resource</type><parameter>ftp_stream</parameter></methodparam>
<methodparam><type>string</type><parameter>directory</parameter></methodparam>
</methodsynopsis>
<para>
Returns an array of filenames from the specified directory
on success, &false; on error.
</para>
</refsect1>
</refentry>
<refentry id="function.ftp-rawlist">
<refnamediv>
<refname>ftp_rawlist</refname>
<refpurpose>
Returns a detailed list of files in the given directory.
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>ftp_rawlist</methodname>
<methodparam><type>resource</type><parameter>ftp_stream</parameter></methodparam>
<methodparam><type>string</type><parameter>directory</parameter></methodparam>
</methodsynopsis>
<para>
<function>ftp_rawlist</function> executes the FTP LIST command,
and returns the result as an array. Each array element corresponds
to one line of text. The output is not parsed in any way. The
system type identifier returned by <function>ftp_systype</function>
can be used to determine how the results should be interpreted.
</para>
</refsect1>
</refentry>
<refentry id="function.ftp-systype">
<refnamediv>
<refname>ftp_systype</refname>
<refpurpose>
Returns the system type identifier of the remote FTP server.
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>ftp_systype</methodname>
<methodparam><type>resource</type><parameter>ftp_stream</parameter></methodparam>
</methodsynopsis>
<para>
Returns the remote system type, or &false; on error.
</para>
</refsect1>
</refentry>
<refentry id="function.ftp-pasv">
<refnamediv>
<refname>ftp_pasv</refname>
<refpurpose>Turns passive mode on or off.</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>ftp_pasv</methodname>
<methodparam><type>resource</type><parameter>ftp_stream</parameter></methodparam>
<methodparam><type>bool</type><parameter>pasv</parameter></methodparam>
</methodsynopsis>
<para>
<function>ftp_pasv</function> turns on passive mode if the
<parameter>pasv</parameter> parameter is &true; (it turns off
passive mode if <parameter>pasv</parameter> is &false;.) In
passive mode, data connections are initiated by the client,
rather than by the server.
</para>
<para>
Returns &true; on success, &false; on error.
</para>
</refsect1>
</refentry>
<refentry id="function.ftp-get">
<refnamediv>
<refname>ftp_get</refname>
<refpurpose>Downloads a file from the FTP server.</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>ftp_get</methodname>
<methodparam><type>resource</type><parameter>ftp_stream</parameter></methodparam>
<methodparam><type>string</type><parameter>local_file</parameter></methodparam>
<methodparam><type>string</type><parameter>remote_file</parameter></methodparam>
<methodparam><type>int</type><parameter>mode</parameter></methodparam>
</methodsynopsis>
<para>
<function>ftp_get</function> retrieves <parameter>remote_file</parameter>
from the FTP server, and saves it to <parameter>local_file</parameter>
locally. The transfer <parameter>mode</parameter> specified must
be either <constant>FTP_ASCII</constant> or
<constant>FTP_BINARY</constant>.
</para>
<para>
Returns &true; on success, &false; on error.
</para>
<para>
See also <function>ftp_fget</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.ftp-fget">
<refnamediv>
<refname>ftp_fget</refname>
<refpurpose>Downloads a file from the FTP server and saves to an
open file.</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>ftp_fget</methodname>
<methodparam><type>resource</type><parameter>ftp_stream</parameter></methodparam>
<methodparam><type>resource</type><parameter>fp</parameter></methodparam>
<methodparam><type>string</type><parameter>remote_file</parameter></methodparam>
<methodparam><type>int</type><parameter>mode</parameter></methodparam>
</methodsynopsis>
<para>
<function>ftp_fget</function> retrieves <parameter>remote_file</parameter>
from the FTP server, and writes it to the given file pointer,
<parameter>fp</parameter>. The transfer <parameter>mode</parameter>
specified must be either <constant>FTP_ASCII</constant> or
<constant>FTP_BINARY</constant>.
</para>
<para>
Returns &true; on success, &false; on error.
</para>
</refsect1>
</refentry>
<refentry id="function.ftp-put">
<refnamediv>
<refname>ftp_put</refname>
<refpurpose>Uploads a file to the FTP server.</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>ftp_put</methodname>
<methodparam><type>resource</type><parameter>ftp_stream</parameter></methodparam>
<methodparam><type>string</type><parameter>remote_file</parameter></methodparam>
<methodparam><type>string</type><parameter>local_file</parameter></methodparam>
<methodparam><type>int</type><parameter>mode</parameter></methodparam>
</methodsynopsis>
<para>
<function>ftp_put</function> stores <parameter>local_file</parameter>
on the FTP server, as <parameter>remote_file</parameter>. The transfer
<parameter>mode</parameter> specified must be either
<constant>FTP_ASCII</constant> or <constant>FTP_BINARY</constant>.
</para>
<para>
Returns &true; on success, &false; on error.
</para>
<para>
<example>
<title><function>ftp_put</function> example</title>
<programlisting role="php">
<![CDATA[
$upload = ftp_put($conn_id, $destination_file, $source_file, FTP_ASCII);
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.ftp-fput">
<refnamediv>
<refname>ftp_fput</refname>
<refpurpose>Uploads from an open file to the FTP server.</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>ftp_fput</methodname>
<methodparam><type>resource</type><parameter>ftp_stream</parameter></methodparam>
<methodparam><type>string</type><parameter>remote_file</parameter></methodparam>
<methodparam><type>resource</type><parameter>fp</parameter></methodparam>
<methodparam><type>int</type><parameter>mode</parameter></methodparam>
</methodsynopsis>
<para>
<function>ftp_fput</function> uploads the data from the file pointer
<parameter>fp</parameter> until end of file. The results are stored
in <parameter>remote_file</parameter> on the FTP server. The transfer
<parameter>mode</parameter> specified must be either
<constant>FTP_ASCII</constant> or <constant>FTP_BINARY</constant>
</para>
<para>
Returns &true; on success, &false; on error.
</para>
</refsect1>
</refentry>
<refentry id="function.ftp-size">
<refnamediv>
<refname>ftp_size</refname>
<refpurpose>Returns the size of the given file.</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>ftp_size</methodname>
<methodparam><type>resource</type><parameter>ftp_stream</parameter></methodparam>
<methodparam><type>string</type><parameter>remote_file</parameter></methodparam>
</methodsynopsis>
<para>
<function>ftp_size</function> returns the size of a file in bytes. If an
error occurs, of if the file does not exist, -1 is returned. Not
all servers support this feature.
</para>
<para>
Returns the file size on success, or -1 on error.
</para>
</refsect1>
</refentry>
<refentry id="function.ftp-mdtm">
<refnamediv>
<refname>ftp_mdtm</refname>
<refpurpose>Returns the last modified time of the given file.</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>ftp_mdtm</methodname>
<methodparam><type>resource</type><parameter>ftp_stream</parameter></methodparam>
<methodparam><type>string</type><parameter>remote_file</parameter></methodparam>
</methodsynopsis>
<para>
<function>ftp_mdtm</function> checks the last-modified time for a
file, and returns it as a UNIX timestamp. If an error occurs, or
the file does not exist, -1 is returned. Note that not all servers
support this feature.
</para>
<para>
Returns a UNIX timestamp on success, or -1 on error.
</para>
<note>
<para>
<function>ftp_mdtm</function> does not work with directories.
</para>
</note>
</refsect1>
</refentry>
<refentry id="function.ftp-rename">
<refnamediv>
<refname>ftp_rename</refname>
<refpurpose>Renames a file on the ftp server.</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>ftp_rename</methodname>
<methodparam><type>resource</type><parameter>ftp_stream</parameter></methodparam>
<methodparam><type>string</type><parameter>from</parameter></methodparam>
<methodparam><type>string</type><parameter>to</parameter></methodparam>
</methodsynopsis>
<para>
<function>ftp_rename</function> renames the file or directory
currently named <parameter>from</parameter> to the new name
<parameter>to</parameter>, on the FTP stream
<parameter>ftp_stream</parameter>.
</para>
<para>
Returns &true; on success, &false; on error.
</para>
</refsect1>
</refentry>
<refentry id="function.ftp-delete">
<refnamediv>
<refname>ftp_delete</refname>
<refpurpose>Deletes a file on the ftp server.</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>ftp_delete</methodname>
<methodparam><type>resource</type><parameter>ftp_stream</parameter></methodparam>
<methodparam><type>string</type><parameter>path</parameter></methodparam>
</methodsynopsis>
<para>
<function>ftp_delete</function> deletes the file specified by
<parameter>path</parameter> from the FTP server.
</para>
<para>
Returns &true; on success, &false; on error.
</para>
</refsect1>
</refentry>
<refentry id="function.ftp-site">
<refnamediv>
<refname>ftp_site</refname>
<refpurpose>Sends a SITE command to the server.</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>ftp_site</methodname>
<methodparam><type>resource</type><parameter>ftp_stream</parameter></methodparam>
<methodparam><type>string</type><parameter>cmd</parameter></methodparam>
</methodsynopsis>
<para>
<function>ftp_site</function> sends the command specified by
<parameter>cmd</parameter> to the FTP server. SITE commands
are not standardized, and vary from server to server. They are
useful for handling such things as file permissions and group
membership.
</para>
<para>
Returns &true; on success, &false; on error.
</para>
</refsect1>
</refentry>
<refentry id="function.ftp-close">
<refnamediv>
<refname>ftp_close</refname>
<refpurpose>Closes an FTP connection</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>ftp_close</methodname>
<methodparam><type>resource</type><parameter>ftp_stream</parameter></methodparam>
</methodsynopsis>
<note>
<para>
This function is only available in CVS.
</para>
</note>
<para>
<function>ftp_close</function> closes <parameter>ftp_stream</parameter>
and releases the resource. You can't reuse this resource but have to
create a new one with <function>ftp_connect</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.ftp-quit">
<refnamediv>
<refname>ftp_quit</refname>
<refpurpose>Closes an FTP connection</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>ftp_quit</methodname>
<methodparam><type>resource</type><parameter>ftp_stream</parameter></methodparam>
</methodsynopsis>
<para>
<function>ftp_quit</function> is an alias for
<function>ftp_close</function>.
</para>
</refsect1>
</refentry>
<refentry id='function.ftp-exec'>
<refnamediv>
<refname>ftp_exec</refname>
<refpurpose>
Request execution of a program on the ftp server.
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>ftp_exec</methodname>
<methodparam><type>resource</type><parameter>stream</parameter></methodparam>
<methodparam><type>string</type><parameter>command</parameter></methodparam>
</methodsynopsis>
<para>
Sends a SITE EXEC <parameter>command</parameter> request to the ftp
server. Returns &false; if the request fails, returns the output of the
command otherwise.
</para>
</refsect1>
</refentry>
<refentry id='function.ftp-set-option'>
<refnamediv>
<refname>ftp_set_option</refname>
<refpurpose>
Set miscellaneous runtime FTP options.
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>ftp_set_option</methodname>
<methodparam><type>resource</type><parameter>stream</parameter></methodparam>
<methodparam><type>int</type><parameter>option</parameter></methodparam>
<methodparam><type>mixed</type><parameter>value</parameter></methodparam>
</methodsynopsis>
<note>
<para>
This function is only available in CVS.
</para>
</note>
<para>
Returns &true; if the option could be set; &false; if not. A warning
message will be thrown if the <parameter>option</parameter> is not
supported or the passed <parameter>value</parameter> doesn't match the
expected value for the given <parameter>option</parameter>.
</para>
<para>
This function controls various runtime options for the specified FTP
stream. The <parameter>value</parameter> parameter depends on which
<parameter>option</parameter> parameter is chosen to be altered.
Currently, the following options are supported:
<table>
<title>Supported runtime FTP options</title>
<tgroup cols="2">
<tbody>
<row>
<entry>FTP_TIMEOUT_SEC</entry>
<entry>Changes the timeout in seconds used for all network related
functions. Parameter <parameter>value</parameter> has be to of type
int and must be greater than 0. The default timeout is 90
seconds.</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
<example>
<title><function>ftp_set_option</function> example</title>
<programlisting role="php">
<![CDATA[
// Set the network timeout down to 10 seconds
ftp_set_option($conn_id, FTP_TIMEOUT_SEC, 10);
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id='function.ftp-get-option'>
<refnamediv>
<refname>ftp_get_option</refname>
<refpurpose>
Retrieves various runtime behaviours of the current FTP stream.
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>ftp_get_option</methodname>
<methodparam><type>resource</type><parameter>stream</parameter></methodparam>
<methodparam><type>int</type><parameter>option</parameter></methodparam>
</methodsynopsis>
<note>
<para>
This function is only available in CVS.
</para>
</note>
<para>
Returns the value on success or &false; if the given
<parameter>option</parameter> is not supposed. In the latter case a
warning message is also thrown.
</para>
<para>
This function returns the <parameter>value</parameter> for the requested
<parameter>option</parameter> from the specified <parameter>FTP
stream</parameter>. Currently, the following options are supported:
<table>
<title>Supported runtime FTP options</title>
<tgroup cols="2">
<tbody>
<row>
<entry>FTP_TIMEOUT_SEC</entry>
<entry>Returns the current timeout used for network related
operations.</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
<example>
<title><function>ftp_get_option</function> example</title>
<programlisting role="php">
<![CDATA[
// Get the timeout of the given FTP stream
$timeout = ftp_get_option($conn_id, FTP_TIMEOUT_SEC);
]]>
</programlisting>
</example>
</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:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=xml
vi: ts=1 sw=1
-->
|