ref.ssh2: new doc style

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@237706 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Mehdi Achour 2007-06-15 00:16:47 +00:00
parent 4384a21398
commit 1c96826f4b
27 changed files with 1741 additions and 661 deletions

View file

@ -1,12 +1,13 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<refentry id="function.ssh2-auth-hostbased-file">
<refnamediv>
<refname>ssh2_auth_hostbased_file</refname>
<refpurpose>Authenticate using a public hostkey</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>ssh2_auth_hostbased_file</methodname>
<methodparam><type>resource</type><parameter>session</parameter></methodparam>
@ -17,17 +18,87 @@
<methodparam choice="opt"><type>string</type><parameter>passphrase</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>local_username</parameter></methodparam>
</methodsynopsis>
<para>
Authenticate using a public hostkey read from a file.
</para>
</refsect1>
<simpara>
Authenticate using a public hostkey read from a file. If <parameter>privkeyfile</parameter>
is encrypted (which it should be), the passphrase must be provided.
If <parameter>local_username</parameter> is omitted, then the value for
<parameter>username</parameter> will be used for it.
</simpara>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>session</parameter></term>
<listitem>
<para>
An SSH connection link identifier, obtained from a call to
<function>ssh2_connect</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>username</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>hostname</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>pubkeyfile</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>privkeyfile</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>passphrase</parameter></term>
<listitem>
<para>
If <parameter>privkeyfile</parameter> is encrypted (which it should
be), the passphrase must be provided.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>local_username</parameter></term>
<listitem>
<para>
If <parameter>local_username</parameter> is omitted, then the value
for <parameter>username</parameter> will be used for it.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<example>
<title>Authentication using a public hostkey</title>
<programlisting role="php">
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Authentication using a public hostkey</title>
<programlisting role="php">
<![CDATA[
<?php
$connection = ssh2_connect('shell.example.com', 22, array('hostkey'=>'ssh-rsa'));
@ -42,16 +113,21 @@ if (ssh2_auth_hostbased_file($connection, 'remoteusername', 'myhost.example.com'
}
?>
]]>
</programlisting>
</example>
<note>
<simpara>
<function>ssh2_auth_hostbased_file</function> requires libssh2 >= 0.7 and PHP/SSH2 >= 0.7
</simpara>
</note>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<note>
<para>
<function>ssh2_auth_hostbased_file</function> requires libssh2 >= 0.7 and
PHP/SSH2 >= 0.7
</para>
</note>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -1,31 +1,64 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.5 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.6 $ -->
<refentry id="function.ssh2-auth-none">
<refnamediv>
<refname>ssh2_auth_none</refname>
<refpurpose>Authenticate as "none"</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>mixed</type><methodname>ssh2_auth_none</methodname>
<methodparam><type>resource</type><parameter>session</parameter></methodparam>
<methodparam><type>string</type><parameter>username</parameter></methodparam>
</methodsynopsis>
<simpara>
<para>
Attempt "none" authentication which usually will (and should) fail.
As part of the failure, this function will return an array of accepted
authentication methods. If the server does accept "none" as an
authentication method for <parameter>username</parameter>, this function
will simply return &true;.
</simpara>
authentication methods.
</para>
</refsect1>
<example>
<title>Using <function>ssh2_auth_none</function> to retreive
a list of authentication methods.</title>
<programlisting role="php">
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>session</parameter></term>
<listitem>
<para>
An SSH connection link identifier, obtained from a call to
<function>ssh2_connect</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>username</parameter></term>
<listitem>
<para>
Remote user name.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns &true; if the server doesc accept "none" as an authentication
method, or an array of accepted authentication methods on failure.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Retreiving a list of authentication methods</title>
<programlisting role="php">
<![CDATA[
<?php
$connection = ssh2_connect('shell.example.com', 22);
@ -37,10 +70,11 @@ if (in_array('password', $auth_methods)) {
}
?>
]]>
</programlisting>
</example>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -1,27 +1,70 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.3 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.4 $ -->
<refentry id="function.ssh2-auth-password">
<refnamediv>
<refname>ssh2_auth_password</refname>
<refpurpose>Authenticate over SSH using a plain password</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>ssh2_auth_password</methodname>
<methodparam><type>resource</type><parameter>session</parameter></methodparam>
<methodparam><type>string</type><parameter>username</parameter></methodparam>
<methodparam><type>string</type><parameter>password</parameter></methodparam>
</methodsynopsis>
<simpara>
<para>
Authenticate over SSH using a plain password
</simpara>
</para>
</refsect1>
<example>
<title>Authenticating with a password</title>
<programlisting role="php">
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>session</parameter></term>
<listitem>
<para>
An SSH connection link identifier, obtained from a call to
<function>ssh2_connect</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>username</parameter></term>
<listitem>
<para>
Remote user name.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>password</parameter></term>
<listitem>
<para>
Password for <parameter>username</parameter>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Authenticating with a password</title>
<programlisting role="php">
<![CDATA[
<?php
$connection = ssh2_connect('shell.example.com', 22);
@ -33,10 +76,11 @@ if (ssh2_auth_password($connection, 'username', 'secret')) {
}
?>
]]>
</programlisting>
</example>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -1,13 +1,13 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.3 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.4 $ -->
<refentry id="function.ssh2-auth-pubkey-file">
<refnamediv>
<refname>ssh2_auth_pubkey_file</refname>
<refpurpose>Authenticate using a public key</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>ssh2_auth_pubkey_file</methodname>
<methodparam><type>resource</type><parameter>session</parameter></methodparam>
@ -16,15 +16,71 @@
<methodparam><type>string</type><parameter>privkeyfile</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>passphrase</parameter></methodparam>
</methodsynopsis>
<para>
Authenticate using a public key read from a file.
</para>
</refsect1>
<simpara>
Authenticate using a public key read from a file. If <parameter>privkeyfile</parameter>
is encrypted (which it should be), the passphrase must be provided.
</simpara>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>session</parameter></term>
<listitem>
<para>
An SSH connection link identifier, obtained from a call to
<function>ssh2_connect</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>username</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>pubkeyfile</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>privkeyfile</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>passphrase</parameter></term>
<listitem>
<para>
If <parameter>privkeyfile</parameter> is encrypted (which it should
be), the <parameter>passphrase</parameter> must be provided.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<example>
<title>Authentication using a public key</title>
<programlisting role="php">
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Authentication using a public key</title>
<programlisting role="php">
<![CDATA[
<?php
$connection = ssh2_connect('shell.example.com', 22, array('hostkey'=>'ssh-rsa'));
@ -38,10 +94,11 @@ if (ssh2_auth_pubkey_file($connection, 'username',
}
?>
]]>
</programlisting>
</example>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -1,13 +1,13 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.7 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.8 $ -->
<refentry id="function.ssh2-connect">
<refnamediv>
<refname>ssh2_connect</refname>
<refpurpose>Connect to an SSH server</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>resource</type><methodname>ssh2_connect</methodname>
<methodparam><type>string</type><parameter>host</parameter></methodparam>
@ -15,213 +15,252 @@
<methodparam choice="opt"><type>array</type><parameter>methods</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>callbacks</parameter></methodparam>
</methodsynopsis>
<simpara>
Establish a connection to a remote SSH server and return a resource on success, &false; on error.
</simpara>
<simpara>
<parameter>methods</parameter> may be an associative array with up to four parameters
as described below.
</simpara>
<para>
<table>
<title><parameter>methods</parameter> may be an associative array
with any or all of the following parameters.</title>
<tgroup cols="3">
<thead>
<row>
<entry>Index</entry>
<entry>Meaning</entry>
<entry>Supported Values*</entry>
</row>
</thead>
<tbody>
<row>
<entry>kex</entry>
<entry>
List of key exchange methods to advertise, comma separated
in order of preference.
</entry>
<entry>
<literal>diffie-hellman-group1-sha1</literal>,
<literal>diffie-hellman-group14-sha1</literal>, and
<literal>diffie-hellman-group-exchange-sha1</literal>
</entry>
</row>
<row>
<entry>hostkey</entry>
<entry>
List of hostkey methods to advertise, come separated
in order of preference.
</entry>
<entry>
<literal>ssh-rsa</literal> and
<literal>ssh-dss</literal>
</entry>
</row>
<row>
<entry>client_to_server</entry>
<entry>
Associative array containing crypt, compression, and
message authentication code (MAC) method preferences
for messages sent from client to server.
</entry>
<entry/>
</row>
<row>
<entry>server_to_client</entry>
<entry>
Associative array containing crypt, compression, and
message authentication code (MAC) method preferences
for messages sent from client to server.
</entry>
<entry/>
</row>
</tbody>
</tgroup>
</table>
Establish a connection to a remote SSH server.
</para>
<simpara>
* - Supported Values are dependent on methods supported by underlying library.
See <ulink url="&url.libssh2;">libssh2</ulink> documentation for additional
information.
</simpara>
<para>
<table>
<title>
<parameter>client_to_server</parameter> and
<parameter>server_to_client</parameter> may be an associative array
with any or all of the following parameters.
</title>
<tgroup cols="3">
<thead>
<row>
<entry>Index</entry>
<entry>Meaning</entry>
<entry>Supported Values*</entry>
</row>
</thead>
<tbody>
<row>
<entry>crypt</entry>
<entry>List of crypto methods to advertise, comma separated
in order of preference.</entry>
<entry>
<literal>rijndael-cbc@lysator.liu.se</literal>,
<literal>aes256-cbc</literal>,
<literal>aes192-cbc</literal>,
<literal>aes128-cbc</literal>,
<literal>3des-cbc</literal>,
<literal>blowfish-cbc</literal>,
<literal>cast128-cbc</literal>,
<literal>arcfour</literal>, and
<literal>none**</literal>
</entry>
</row>
<row>
<entry>comp</entry>
<entry>List of compression methods to advertise, comma separated
in order of preference.</entry>
<entry>
<literal>zlib</literal> and
<literal>none</literal>
</entry>
</row>
<row>
<entry>mac</entry>
<entry>List of MAC methods to advertise, come separated
in order of preference.</entry>
<entry>
<literal>hmac-sha1</literal>,
<literal>hmac-sha1-96</literal>,
<literal>hmac-ripemd160</literal>,
<literal>hmac-ripemd160@openssh.com</literal>, and
<literal>none**</literal>
</entry>
</row>
</tbody>
</tgroup>
</table>
Once connected, the client should verify the server's hostkey using
<function>ssh2_fingerprint</function>, then authenticate using either
password or public key.
</para>
</refsect1>
<note>
<title>Crypt and MAC method "<literal>none</literal>"</title>
<simpara>
For security reasons, <literal>none</literal> is disabled by the underlying
<ulink url="&url.libssh2;">libssh2</ulink> library unless explicitly enabled
during build time by using the appropriate ./configure options. See documentation
for the underlying library for more information.
</simpara>
</note>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<table>
<title><parameter>callbackss</parameter> may be an associative array
with any or all of the following parameters.</title>
<tgroup cols="3">
<thead>
<row>
<entry>Index</entry>
<entry>Meaning</entry>
<entry>Prototype</entry>
</row>
</thead>
<tbody>
<row>
<entry>ignore</entry>
<entry>
Name of function to call when an
<constant>SSH2_MSG_IGNORE</constant>
packet is received
</entry>
<entry>void ignore_cb($message)</entry>
</row>
<row>
<entry>debug</entry>
<entry>
Name of function to call when an
<constant>SSH2_MSG_DEBUG</constant>
packet is received
</entry>
<entry>void debug_cb($message, $language, $always_display)</entry>
</row>
<row>
<entry>macerror</entry>
<entry>
Name of function to call when a
packet is received but the message authentication
code failed. If the callback returns &true;,
the mismatch will be ignored, otherwise the
connection will be terminated.
</entry>
<entry>bool macerror_cb($packet)</entry>
</row>
<row>
<entry>disconnect</entry>
<entry>
Name of function to call when an
<constant>SSH2_MSG_DISCONNECT</constant>
packet is received
</entry>
<entry>void disconnect_cb($reason, $message, $language)</entry>
</row>
</tbody>
</tgroup>
</table>
<variablelist>
<varlistentry>
<term><parameter>host</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>port</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>methods</parameter></term>
<listitem>
<para>
<parameter>methods</parameter> may be an associative array with up to four parameters
as described below.
</para>
<para>
<table>
<title><parameter>methods</parameter> may be an associative array
with any or all of the following parameters.</title>
<tgroup cols="3">
<thead>
<row>
<entry>Index</entry>
<entry>Meaning</entry>
<entry>Supported Values*</entry>
</row>
</thead>
<tbody>
<row>
<entry>kex</entry>
<entry>
List of key exchange methods to advertise, comma separated
in order of preference.
</entry>
<entry>
<literal>diffie-hellman-group1-sha1</literal>,
<literal>diffie-hellman-group14-sha1</literal>, and
<literal>diffie-hellman-group-exchange-sha1</literal>
</entry>
</row>
<row>
<entry>hostkey</entry>
<entry>
List of hostkey methods to advertise, come separated
in order of preference.
</entry>
<entry>
<literal>ssh-rsa</literal> and
<literal>ssh-dss</literal>
</entry>
</row>
<row>
<entry>client_to_server</entry>
<entry>
Associative array containing crypt, compression, and
message authentication code (MAC) method preferences
for messages sent from client to server.
</entry>
<entry/>
</row>
<row>
<entry>server_to_client</entry>
<entry>
Associative array containing crypt, compression, and
message authentication code (MAC) method preferences
for messages sent from client to server.
</entry>
<entry/>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
* - Supported Values are dependent on methods supported by underlying library.
See <ulink url="&url.libssh2;">libssh2</ulink> documentation for additional
information.
</para>
<para>
<table>
<title>
<parameter>client_to_server</parameter> and
<parameter>server_to_client</parameter> may be an associative array
with any or all of the following parameters.
</title>
<tgroup cols="3">
<thead>
<row>
<entry>Index</entry>
<entry>Meaning</entry>
<entry>Supported Values*</entry>
</row>
</thead>
<tbody>
<row>
<entry>crypt</entry>
<entry>List of crypto methods to advertise, comma separated
in order of preference.</entry>
<entry>
<literal>rijndael-cbc@lysator.liu.se</literal>,
<literal>aes256-cbc</literal>,
<literal>aes192-cbc</literal>,
<literal>aes128-cbc</literal>,
<literal>3des-cbc</literal>,
<literal>blowfish-cbc</literal>,
<literal>cast128-cbc</literal>,
<literal>arcfour</literal>, and
<literal>none**</literal>
</entry>
</row>
<row>
<entry>comp</entry>
<entry>List of compression methods to advertise, comma separated
in order of preference.</entry>
<entry>
<literal>zlib</literal> and
<literal>none</literal>
</entry>
</row>
<row>
<entry>mac</entry>
<entry>List of MAC methods to advertise, come separated
in order of preference.</entry>
<entry>
<literal>hmac-sha1</literal>,
<literal>hmac-sha1-96</literal>,
<literal>hmac-ripemd160</literal>,
<literal>hmac-ripemd160@openssh.com</literal>, and
<literal>none**</literal>
</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
<note>
<title>Crypt and MAC method "<literal>none</literal>"</title>
<para>
For security reasons, <literal>none</literal> is disabled by the underlying
<ulink url="&url.libssh2;">libssh2</ulink> library unless explicitly enabled
during build time by using the appropriate ./configure options. See documentation
for the underlying library for more information.
</para>
</note>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>callbacks</parameter></term>
<listitem>
<para>
<parameter>callbackss</parameter> may be an associative array with any
or all of the following parameters.
<table>
<tgroup cols="3">
<thead>
<row>
<entry>Index</entry>
<entry>Meaning</entry>
<entry>Prototype</entry>
</row>
</thead>
<tbody>
<row>
<entry>ignore</entry>
<entry>
Name of function to call when an
<constant>SSH2_MSG_IGNORE</constant> packet is received
</entry>
<entry>void ignore_cb($message)</entry>
</row>
<row>
<entry>debug</entry>
<entry>
Name of function to call when an
<constant>SSH2_MSG_DEBUG</constant> packet is received
</entry>
<entry>void debug_cb($message, $language, $always_display)</entry>
</row>
<row>
<entry>macerror</entry>
<entry>
Name of function to call when a packet is received but the
message authentication code failed. If the callback returns
&true;, the mismatch will be ignored, otherwise the connection
will be terminated.
</entry>
<entry>bool macerror_cb($packet)</entry>
</row>
<row>
<entry>disconnect</entry>
<entry>
Name of function to call when an
<constant>SSH2_MSG_DISCONNECT</constant> packet is received
</entry>
<entry>void disconnect_cb($reason, $message, $language)</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<example>
<title>
Open a connection forcing 3des-cbc when sending packets,
any strength aes cipher when receiving packets,
no compression in either direction,
and Group1 key exchange.
</title>
<programlisting role="php">
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a resource on success, or &false; on error.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>ssh2_connect</function> example</title>
<para>
Open a connection forcing 3des-cbc when sending packets, any strength
aes cipher when receiving packets, no compression in either direction,
and Group1 key exchange.
</para>
<programlisting role="php">
<![CDATA[
<?php
/* Notify the user if the server terminates the connection */
@ -245,24 +284,23 @@ $connection = ssh2_connect('shell.example.com', 22, $methods, $callbacks);
if (!$connection) die('Connection failed');
?>
]]>
</programlisting>
</example>
<simpara>
Once connected, the client should verify the server's hostkey
using <function>ssh2_fingerprint</function>, then authenticate
using either password or public key.
</simpara>
<simpara>
See Also:
<function>ssh2_fingerprint</function>,
<function>ssh2_auth_none</function>,
<function>ssh2_auth_password</function>, and
<function>ssh2_auth_pubkey_file</function>
</simpara>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>ssh2_fingerprint</function></member>
<member><function>ssh2_auth_none</function></member>
<member><function>ssh2_auth_password</function></member>
<member><function>ssh2_auth_pubkey_file</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -1,13 +1,13 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.6 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.7 $ -->
<refentry id="function.ssh2-exec">
<refnamediv>
<refname>ssh2_exec</refname>
<refpurpose>Execute a command on a remote server</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>resource</type><methodname>ssh2_exec</methodname>
<methodparam><type>resource</type><parameter>session</parameter></methodparam>
@ -18,15 +18,90 @@
<methodparam choice="opt"><type>int</type><parameter>height</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>width_height_type</parameter></methodparam>
</methodsynopsis>
<simpara>
<para>
Execute a command at the remote end and allocate a channel for it.
Returns a stream on success or &false; on failure.
</simpara>
</para>
</refsect1>
<example>
<title>Executing a command</title>
<programlisting role="php">
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>session</parameter></term>
<listitem>
<para>
An SSH connection link identifier, obtained from a call to
<function>ssh2_connect</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>command</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>pty</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>env</parameter></term>
<listitem>
<para>
<parameter>env</parameter> may be passed as an associative array of
name/value pairs to set in the target environment.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>width</parameter></term>
<listitem>
<para>
Width of the virtual terminal.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>height</parameter></term>
<listitem>
<para>
Height of the virtual terminal.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>width_height_type</parameter></term>
<listitem>
<para>
<parameter>width_height_type</parameter> should be one of
<constant>SSH2_TERM_UNIT_CHARS</constant> or
<constant>SSH2_TERM_UNIT_PIXELS</constant>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a stream on success or &false; on failure.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Executing a command</title>
<programlisting role="php">
<![CDATA[
<?php
$connection = ssh2_connect('shell.example.com', 22);
@ -35,16 +110,22 @@ ssh2_auth_password($connection, 'username', 'password');
$stream = ssh2_exec($connection, '/usr/local/bin/php -i');
?>
]]>
</programlisting>
</example>
<simpara>
See Also:
<function>ssh2_connect</function>,
<function>ssh2_shell</function>, and
<function>ssh2_tunnel</function>
</simpara>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>ssh2_connect</function></member>
<member><function>ssh2_shell</function></member>
<member><function>ssh2_tunnel</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -1,29 +1,61 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.5 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.6 $ -->
<refentry id="function.ssh2-fetch-stream">
<refnamediv>
<refname>ssh2_fetch_stream</refname>
<refpurpose>Fetch an extended data stream</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>resource</type><methodname>ssh2_fetch_stream</methodname>
<methodparam><type>resource</type><parameter>channel</parameter></methodparam>
<methodparam><type>int</type><parameter>streamid</parameter></methodparam>
</methodsynopsis>
<para>
Fetches an alternate substream associated with an SSH2 channel stream.
The SSH2 protocol currently defines only one substream, STDERR, which has
a substream ID of <constant>SSH2_STREAM_STDERR</constant> (defined as 1).
</para>
</refsect1>
<simpara>
Fetches an alternate substream associated with an SSH2 channel stream
identified by <parameter>streamid</parameter>. The SSH2 protocol
currently defines only one substream, STDERR, which has a substream ID
of <constant>SSH2_STREAM_STDERR</constant> (defined as 1).
</simpara>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>channel</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>streamid</parameter></term>
<listitem>
<para>
An SSH2 channel stream.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<example>
<title>Opening a shell and retrieving the stderr stream associated with it.</title>
<programlisting role="php">
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the requested stream resource.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Opening a shell and retrieving the stderr stream associated with it</title>
<programlisting role="php">
<![CDATA[
<?php
$connection = ssh2_connect('shell.example.com', 22);
@ -33,17 +65,22 @@ $stdio_stream = ssh2_shell($connection);
$stderr_stream = ssh2_fetch_stream($stdio_stream, SSH2_STREAM_STDERR);
?>
]]>
</programlisting>
</example>
<simpara>
See Also:
<function>ssh2_shell</function>,
<function>ssh2_exec</function>, and
<function>ssh2_connect</function>
</simpara>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>ssh2_shell</function></member>
<member><function>ssh2_exec</function></member>
<member><function>ssh2_connect</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -1,37 +1,67 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.4 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.5 $ -->
<refentry id="function.ssh2-fingerprint">
<refnamediv>
<refname>ssh2_fingerprint</refname>
<refpurpose>Retreive fingerprint of remote server</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>ssh2_fingerprint</methodname>
<methodparam><type>resource</type><parameter>session</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>flags</parameter></methodparam>
</methodsynopsis>
<simpara>
<para>
Returns a server hostkey hash from an active session.
Defaults to MD5 fingerprint encoded as ASCII hex values.
</simpara>
</para>
</refsect1>
<simpara>
<parameter>flags</parameter> may be either of
<constant>SSH2_FINGERPRINT_MD5</constant> or
<constant>SSH2_FINGERPRINT_SHA1</constant> logically ORed with
<constant>SSH2_FINGERPRINT_HEX</constant> or
<constant>SSH2_FINGERPRINT_RAW</constant>.
Defaults to <constant>SSH2_FINGERPRINT_MD5</constant> |
<constant>SSH2_FINGERPRINT_HEX</constant>.
</simpara>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>session</parameter></term>
<listitem>
<para>
An SSH connection link identifier, obtained from a call to
<function>ssh2_connect</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>flags</parameter></term>
<listitem>
<para>
<parameter>flags</parameter> may be either of
<constant>SSH2_FINGERPRINT_MD5</constant> or
<constant>SSH2_FINGERPRINT_SHA1</constant> logically ORed with
<constant>SSH2_FINGERPRINT_HEX</constant> or
<constant>SSH2_FINGERPRINT_RAW</constant>.
Defaults to <constant>SSH2_FINGERPRINT_MD5</constant> |
<constant>SSH2_FINGERPRINT_HEX</constant>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<example>
<title>Checking the fingerprint against a known value</title>
<programlisting role="php">
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the hostkey hash as a string.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Checking the fingerprint against a known value</title>
<programlisting role="php">
<![CDATA[
<?php
$known_host = '6F89C2F0A719B30CC38ABDF90755F2E4';
@ -47,10 +77,11 @@ if ($fingerprint != $known_host) {
}
?>
]]>
</programlisting>
</example>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -1,22 +1,48 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.5 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.6 $ -->
<refentry id="function.ssh2-methods-negotiated">
<refnamediv>
<refname>ssh2_methods_negotiated</refname>
<refpurpose>Return list of negotiated methods</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>array</type><methodname>ssh2_methods_negotiated</methodname>
<methodparam><type>resource</type><parameter>session</parameter></methodparam>
</methodsynopsis>
<para>
Returns list of negotiated methods.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>session</parameter></term>
<listitem>
<para>
An SSH connection link identifier, obtained from a call to
<function>ssh2_connect</function>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Determining what methods were negotiated</title>
@ -45,12 +71,15 @@ echo "\tMAC: {$methods['server_to_client']['mac']}\n";
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
See Also:
<function>ssh2_connect</function>
<simplelist>
<member><function>ssh2_connect</function></member>
</simplelist>
</para>
</refsect1>
</refentry>

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
<!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.7 $ -->
<refentry id="function.ssh2-publickey-add">
<refnamediv>
<refname>ssh2_publickey_add</refname>
@ -119,6 +118,7 @@ ssh2_publickey_add($ssh2, 'ssh-rsa', $keyblob, false, array('comment'=>"John's K
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -1,5 +1,5 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.3 $ -->
<!-- $Revision: 1.4 $ -->
<refentry id="function.ssh2-publickey-init">
<refnamediv>
<refname>ssh2_publickey_init</refname>
@ -24,19 +24,36 @@
If the remote server does not support the publickey subsystem,
the <function>ssh2_publickey_init</function> function will return &false;.
</para>
&note.ssh2.subsystem.publickey;
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>session</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns an <literal>SSH2 Publickey Subsystem</literal>
resource for use with all other ssh2_publickey_*() methods.
Returns an <literal>SSH2 Publickey Subsystem</literal> resource for use
with all other ssh2_publickey_*() methods, or &false on failure.
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
&note.ssh2.subsystem.publickey;
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
@ -47,6 +64,7 @@
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.5 $ -->
<!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.6 $ -->
<refentry id="function.ssh2-publickey-list">
<refnamediv>
<refname>ssh2_publickey_list</refname>
@ -15,9 +14,9 @@
<type>array</type><methodname>ssh2_publickey_list</methodname>
<methodparam><type>resource</type><parameter>pkey</parameter></methodparam>
</methodsynopsis>
&note.ssh2.subsystem.publickey;
<para>
List currently authorized publickeys.
</para>
</refsect1>
<refsect1 role="parameters">
@ -123,6 +122,11 @@ Comment: Alice's Key
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
&note.ssh2.subsystem.publickey;
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
@ -133,6 +137,7 @@ Comment: Alice's Key
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.4 $ -->
<refentry id="function.ssh2-publickey-remove">
<refnamediv>
<refname>ssh2_publickey_remove</refname>
@ -17,9 +16,9 @@
<methodparam><type>string</type><parameter>algoname</parameter></methodparam>
<methodparam><type>string</type><parameter>blob</parameter></methodparam>
</methodsynopsis>
&note.ssh2.subsystem.publickey;
<para>
Removes an authorized publickey.
</para>
</refsect1>
<refsect1 role="parameters">
@ -61,6 +60,11 @@
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
&note.ssh2.subsystem.publickey;
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>

View file

@ -1,13 +1,13 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.3 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.4 $ -->
<refentry id="function.ssh2-scp-recv">
<refnamediv>
<refname>ssh2_scp_recv</refname>
<refpurpose>Request a file via SCP</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>ssh2_scp_recv</methodname>
<methodparam><type>resource</type><parameter>session</parameter></methodparam>
@ -17,6 +17,50 @@
<para>
Copy a file from the remote server to the local filesystem using the SCP protocol.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>session</parameter></term>
<listitem>
<para>
An SSH connection link identifier, obtained from a call to
<function>ssh2_connect</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>remote_file</parameter></term>
<listitem>
<para>
Path to the remote file.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>local_file</parameter></term>
<listitem>
<para>
Path to the local file.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Downloading a file via SCP</title>
@ -32,12 +76,18 @@ ssh2_scp_recv($connection, '/remote/filename', '/local/filename');
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
See Also:
<function>ssh2_scp_send</function>, and
<function>copy</function>
<simplelist>
<member><function>ssh2_scp_send</function></member>
<member><function>copy</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -1,13 +1,13 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.4 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.5 $ -->
<refentry id="function.ssh2-scp-send">
<refnamediv>
<refname>ssh2_scp_send</refname>
<refpurpose>Send a file via SCP</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>ssh2_scp_send</methodname>
<methodparam><type>resource</type><parameter>session</parameter></methodparam>
@ -15,15 +15,66 @@
<methodparam><type>string</type><parameter>remote_file</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>create_mode</parameter></methodparam>
</methodsynopsis>
<simpara>
<para>
Copy a file from the local filesystem to the remote server using the SCP protocol.
The file will be created with the mode specified by <parameter>create_mode</parameter>.
</simpara>
</para>
</refsect1>
<example>
<title>Uploading a file via SCP</title>
<programlisting role="php">
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>session</parameter></term>
<listitem>
<para>
An SSH connection link identifier, obtained from a call to
<function>ssh2_connect</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>local_file</parameter></term>
<listitem>
<para>
Path to the local file.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>remote_file</parameter></term>
<listitem>
<para>
Path to the remote file.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>create_mode</parameter></term>
<listitem>
<para>
The file will be created with the mode specified by
<parameter>create_mode</parameter>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Uploading a file via SCP</title>
<programlisting role="php">
<![CDATA[
<?php
$connection = ssh2_connect('shell.example.com', 22);
@ -32,16 +83,21 @@ ssh2_auth_password($connection, 'username', 'password');
ssh2_scp_send($connection, '/local/filename', '/remote/filename', 0644);
?>
]]>
</programlisting>
</example>
<simpara>
See Also:
<function>ssh2_scp_recv</function>, and
<function>copy</function>
</simpara>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>ssh2_scp_recv</function></member>
<member><function>copy</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -1,31 +1,66 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.4 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.5 $ -->
<refentry id="function.ssh2-sftp-lstat">
<refnamediv>
<refname>ssh2_sftp_lstat</refname>
<refpurpose>Stat a symbolic link</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>array</type><methodname>ssh2_sftp_lstat</methodname>
<methodparam><type>resource</type><parameter>sftp</parameter></methodparam>
<methodparam><type>string</type><parameter>path</parameter></methodparam>
</methodsynopsis>
<simpara>
<para>
Stats a symbolic link on the remote filesystem <emphasis>without</emphasis>
following the link. This function is similar to using the
<function>lstat</function> function with the
<link linkend="wrappers.ssh2">ssh2.sftp://</link> wrapper in PHP5
and returns the same values. See the documentation for
<function>stat</function> for details on the values which may be returned.
</simpara>
following the link.
</para>
<para>
This function is similar to using the <function>lstat</function> function
with the <link linkend="wrappers.ssh2">ssh2.sftp://</link> wrapper in PHP5
and returns the same values.
</para>
</refsect1>
<example>
<title>Stating a symbolic link via SFTP</title>
<programlisting role="php">
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>sftp</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>path</parameter></term>
<listitem>
<para>
Path to the remote symbolic link.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
See the documentation for <function>stat</function> for details on the
values which may be returned.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Stating a symbolic link via SFTP</title>
<programlisting role="php">
<![CDATA[
<?php
$connection = ssh2_connect('shell.example.com', 22);
@ -42,17 +77,22 @@ $mtime = $statinfo['mtime'];
$mode = $statinfo['mode'];
?>
]]>
</programlisting>
</example>
<simpara>
See Also:
<function>ssh2_sftp_stat</function>,
<function>lstat</function>, and
<function>stat</function>
</simpara>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>ssh2_sftp_stat</function></member>
<member><function>lstat</function></member>
<member><function>stat</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -1,13 +1,13 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.6 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.7 $ -->
<refentry id="function.ssh2-sftp-mkdir">
<refnamediv>
<refname>ssh2_sftp_mkdir</refname>
<refpurpose>Create a directory</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>ssh2_sftp_mkdir</methodname>
<methodparam><type>resource</type><parameter>sftp</parameter></methodparam>
@ -15,19 +15,70 @@
<methodparam choice="opt"><type>int</type><parameter>mode</parameter></methodparam>
<methodparam choice="opt"><type>bool</type><parameter>recursive</parameter></methodparam>
</methodsynopsis>
<simpara>
<para>
Creates a directory on the remote file server with permissions set to
<parameter>mode</parameter>. If <parameter>recursive</parameter> is &true;
any parent directories required for <parameter>dirname</parameter> will
be automatically created as well.
<parameter>mode</parameter>.
</para>
<para>
This function is similar to using <function>mkdir</function> with the
<link linkend="wrappers.ssh2">ssh2.sftp://</link> wrapper.
</simpara>
</para>
</refsect1>
<example>
<title>Creating a directory on a remote server</title>
<programlisting role="php">
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>sftp</parameter></term>
<listitem>
<para>
An SSH2 SFTP resource opened by <function>ssh2_sftp</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>dirname</parameter></term>
<listitem>
<para>
Path of the new directory.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>mode</parameter></term>
<listitem>
<para>
Permissions on the new directory.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>recursive</parameter></term>
<listitem>
<para>
If <parameter>recursive</parameter> is &true; any parent directories
required for <parameter>dirname</parameter> will be automatically created as well.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Creating a directory on a remote server</title>
<programlisting role="php">
<![CDATA[
<?php
$connection = ssh2_connect('shell.example.com', 22);
@ -38,16 +89,21 @@ ssh2_sftp_mkdir($sftp, '/home/username/newdir');
/* Or: mkdir("ssh2.sftp://$sftp/home/username/newdir"); */
?>
]]>
</programlisting>
</example>
<simpara>
See Also:
<function>mkdir</function>, and
<function>ssh2_sftp_rmdir</function>
</simpara>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>mkdir</function></member>
<member><function>ssh2_sftp_rmdir</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -1,26 +1,60 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.3 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.4 $ -->
<refentry id="function.ssh2-sftp-readlink">
<refnamediv>
<refname>ssh2_sftp_readlink</refname>
<refpurpose>Return the target of a symbolic link</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>ssh2_sftp_readlink</methodname>
<methodparam><type>resource</type><parameter>sftp</parameter></methodparam>
<methodparam><type>string</type><parameter>link</parameter></methodparam>
</methodsynopsis>
<simpara>
<para>
Returns the target of a symbolic link.
</simpara>
</para>
</refsect1>
<example>
<title>Reading a symbolic link</title>
<programlisting role="php">
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>sftp</parameter></term>
<listitem>
<para>
An SSH2 SFTP resource opened by <function>ssh2_sftp</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>link</parameter></term>
<listitem>
<para>
Path of the symbolic link.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the target of the symbolic <parameter>link</parameter>.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Reading a symbolic link</title>
<programlisting role="php">
<![CDATA[
<?php
$connection = ssh2_connect('shell.example.com', 22);
@ -31,16 +65,21 @@ $target = ssh2_sftp_readlink($sftp, '/tmp/mysql.sock');
/* $target is now (e.g.): '/var/run/mysql.sock' */
?>
]]>
</programlisting>
</example>
<simpara>
See Also:
<function>readlink</function>, and
<function>ssh2_sftp_symlink</function>
</simpara>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>readlink</function></member>
<member><function>ssh2_sftp_symlink</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -1,27 +1,60 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.3 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.4 $ -->
<refentry id="function.ssh2-sftp-realpath">
<refnamediv>
<refname>ssh2_sftp_realpath</refname>
<refpurpose>Resolve the realpath of a provided path string</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>ssh2_sftp_realpath</methodname>
<methodparam><type>resource</type><parameter>sftp</parameter></methodparam>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
</methodsynopsis>
<simpara>
<para>
Translates <parameter>filename</parameter> into the effective real path
on the remote filesystem.
</simpara>
</para>
</refsect1>
<example>
<title>Resolving a pathname</title>
<programlisting role="php">
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>sftp</parameter></term>
<listitem>
<para>
An SSH2 SFTP resource opened by <function>ssh2_sftp</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>filename</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the real path as a string.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Resolving a pathname</title>
<programlisting role="php">
<![CDATA[
<?php
$connection = ssh2_connect('shell.example.com', 22);
@ -32,17 +65,22 @@ $realpath = ssh2_sftp_realpath($sftp, '/home/username/../../../..//./usr/../etc/
/* $realpath is now: '/etc/passwd' */
?>
]]>
</programlisting>
</example>
<simpara>
See Also:
<function>realpath</function>, and
<function>ssh2_sftp_symlink</function>
<function>ssh2_sftp_readlink</function>
</simpara>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>realpath</function></member>
<member><function>ssh2_sftp_symlink</function></member>
<member><function>ssh2_sftp_readlink</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -1,27 +1,67 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.3 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.4 $ -->
<refentry id="function.ssh2-sftp-rename">
<refnamediv>
<refname>ssh2_sftp_rename</refname>
<refpurpose>Rename a remote file</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>ssh2_sftp_rename</methodname>
<methodparam><type>resource</type><parameter>sftp</parameter></methodparam>
<methodparam><type>string</type><parameter>from</parameter></methodparam>
<methodparam><type>string</type><parameter>to</parameter></methodparam>
</methodsynopsis>
<simpara>
<para>
Renames a file on the remote filesystem.
</simpara>
</para>
</refsect1>
<example>
<title>Renaming a file via sftp</title>
<programlisting role="php">
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>sftp</parameter></term>
<listitem>
<para>
An SSH2 SFTP resource opened by <function>ssh2_sftp</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>from</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>to</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Renaming a file via sftp</title>
<programlisting role="php">
<![CDATA[
<?php
$connection = ssh2_connect('shell.example.com', 22);
@ -31,15 +71,20 @@ $sftp = ssh2_sftp($connection);
ssh2_sftp_rename($sftp, '/home/username/oldname', '/home/username/newname');
?>
]]>
</programlisting>
</example>
<simpara>
See Also:
<function>rename</function>
</simpara>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>rename</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -1,28 +1,63 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.5 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.6 $ -->
<refentry id="function.ssh2-sftp-rmdir">
<refnamediv>
<refname>ssh2_sftp_rmdir</refname>
<refpurpose>Remove a directory</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>ssh2_sftp_rmdir</methodname>
<methodparam><type>resource</type><parameter>sftp</parameter></methodparam>
<methodparam><type>string</type><parameter>dirname</parameter></methodparam>
</methodsynopsis>
<simpara>
<para>
Removes a directory from the remote file server.
</para>
<para>
This function is similar to using <function>rmdir</function> with the
<link linkend="wrappers.ssh2">ssh2.sftp://</link> wrapper.
</simpara>
</para>
</refsect1>
<example>
<title>Removing a directory on a remote server</title>
<programlisting role="php">
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>sftp</parameter></term>
<listitem>
<para>
An SSH2 SFTP resource opened by <function>ssh2_sftp</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>dirname</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Removing a directory on a remote server</title>
<programlisting role="php">
<![CDATA[
<?php
$connection = ssh2_connect('shell.example.com', 22);
@ -33,17 +68,21 @@ ssh2_sftp_rmdir($sftp, '/home/username/deltodel');
/* Or: rmdir("ssh2.sftp://$sftp/home/username/dirtodel"); */
?>
]]>
</programlisting>
</example>
<simpara>
See Also:
<function>rmdir</function>, and
<function>ssh2_sftp_mkdir</function>
</simpara>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>rmdir</function></member>
<member><function>ssh2_sftp_mkdir</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -1,30 +1,65 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.4 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.5 $ -->
<refentry id="function.ssh2-sftp-stat">
<refnamediv>
<refname>ssh2_sftp_stat</refname>
<refpurpose>Stat a file on a remote filesystem</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>array</type><methodname>ssh2_sftp_stat</methodname>
<methodparam><type>resource</type><parameter>sftp</parameter></methodparam>
<methodparam><type>string</type><parameter>path</parameter></methodparam>
</methodsynopsis>
<simpara>
<para>
Stats a file on the remote filesystem following any symbolic links.
</para>
<para>
This function is similar to using the <function>stat</function> function
with the <link linkend="wrappers.ssh2">ssh2.sftp://</link> wrapper in PHP5
and returns the same values. See the documentation for
<function>stat</function> for details on the values which may be returned.
</simpara>
and returns the same values.
</para>
</refsect1>
<example>
<title>Stating a file via SFTP</title>
<programlisting role="php">
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>sftp</parameter></term>
<listitem>
<para>
An SSH2 SFTP resource opened by <function>ssh2_sftp</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>path</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
See the documentation for <function>stat</function> for details on the
values which may be returned.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Stating a file via SFTP</title>
<programlisting role="php">
<![CDATA[
<?php
$connection = ssh2_connect('shell.example.com', 22);
@ -41,17 +76,22 @@ $mtime = $statinfo['mtime'];
$mode = $statinfo['mode'];
?>
]]>
</programlisting>
</example>
<simpara>
See Also:
<function>ssh2_sftp_lstat</function>,
<function>lstat</function>, and
<function>stat</function>
</simpara>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>ssh2_sftp_lstat</function></member>
<member><function>lstat</function></member>
<member><function>stat</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -1,28 +1,69 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.3 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.4 $ -->
<refentry id="function.ssh2-sftp-symlink">
<refnamediv>
<refname>ssh2_sftp_symlink</refname>
<refpurpose>Create a symlink</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>ssh2_sftp_symlink</methodname>
<methodparam><type>resource</type><parameter>sftp</parameter></methodparam>
<methodparam><type>string</type><parameter>target</parameter></methodparam>
<methodparam><type>string</type><parameter>link</parameter></methodparam>
</methodsynopsis>
<para>
Creates a symbolic link named <parameter>link</parameter> on the remote
filesystem pointing to <parameter>target</parameter>.
</para>
</refsect1>
<simpara>
Creates a symbolic link named <parameter>link</parameter> on the remote filesystem
pointing to <parameter>target</parameter>.
</simpara>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>sftp</parameter></term>
<listitem>
<para>
An SSH2 SFTP resource opened by <function>ssh2_sftp</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>target</parameter></term>
<listitem>
<para>
Target of the symbolic link.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>link</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<example>
<title>Creating a symbolic link</title>
<programlisting role="php">
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Creating a symbolic link</title>
<programlisting role="php">
<![CDATA[
<?php
$connection = ssh2_connect('shell.example.com', 22);
@ -32,16 +73,21 @@ $sftp = ssh2_sftp($connection);
ssh2_sftp_symlink($sftp, '/var/run/mysql.sock', '/tmp/mysql.sock');
?>
]]>
</programlisting>
</example>
<simpara>
See Also:
<function>symlink</function>, and
<function>ssh2_sftp_readlink</function>
</simpara>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>ssh2_sftp_readlink</function></member>
<member><function>symlink</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -1,26 +1,59 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.3 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.4 $ -->
<refentry id="function.ssh2-sftp-unlink">
<refnamediv>
<refname>ssh2_sftp_unlink</refname>
<refpurpose>Delete a file</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>ssh2_sftp_unlink</methodname>
<methodparam><type>resource</type><parameter>sftp</parameter></methodparam>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
</methodsynopsis>
<para>
Deletes a file on the remote filesystem.
</para>
</refsect1>
<simpara>
Deletes a file on the remote filesystem
</simpara>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>sftp</parameter></term>
<listitem>
<para>
An SSH2 SFTP resource opened by <function>ssh2_sftp</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>filename</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<example>
<title>Deleting a file</title>
<programlisting role="php">
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Deleting a file</title>
<programlisting role="php">
<![CDATA[
<?php
$connection = ssh2_connect('shell.example.com', 22);
@ -30,15 +63,20 @@ $sftp = ssh2_sftp($connection);
ssh2_sftp_unlink($sftp, '/home/username/stale_file');
?>
]]>
</programlisting>
</example>
<simpara>
See Also:
<function>unlink</function>
</simpara>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>unlink</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -1,31 +1,54 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.3 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.4 $ -->
<refentry id="function.ssh2-sftp">
<refnamediv>
<refname>ssh2_sftp</refname>
<refpurpose>Initialize SFTP subsystem</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>resource</type><methodname>ssh2_sftp</methodname>
<methodparam><type>resource</type><parameter>session</parameter></methodparam>
</methodsynopsis>
<simpara>
<para>
Request the SFTP subsystem from an already connected SSH2 server.
</simpara>
</para>
</refsect1>
<simpara>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>session</parameter></term>
<listitem>
<para>
An SSH connection link identifier, obtained from a call to
<function>ssh2_connect</function>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
This method returns an <literal>SSH2 SFTP</literal> resource for use with
all other ssh2_sftp_*() methods and the
<link linkend="wrappers.ssh2">ssh2.sftp://</link> fopen wrapper.
</simpara>
</para>
</refsect1>
<example>
<title>Opening a file via SFTP</title>
<programlisting role="php">
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Opening a file via SFTP</title>
<programlisting role="php">
<![CDATA[
<?php
$connection = ssh2_connect('shell.example.com', 22);
@ -36,16 +59,21 @@ $sftp = ssh2_sftp($connection);
$stream = fopen("ssh2.sftp://$sftp/path/to/file", 'r');
?>
]]>
</programlisting>
</example>
<simpara>
See Also:
<function>ssh2_scp_send</function>, and
<function>ssh2_scp_recv</function>
</simpara>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>ssh2_scp_recv</function></member>
<member><function>ssh2_scp_send</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -1,13 +1,13 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.5 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.6 $ -->
<refentry id="function.ssh2-shell">
<refnamediv>
<refname>ssh2_shell</refname>
<refpurpose>Request an interactive shell</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>resource</type><methodname>ssh2_shell</methodname>
<methodparam><type>resource</type><parameter>session</parameter></methodparam>
@ -17,26 +17,86 @@
<methodparam choice="opt"><type>int</type><parameter>height</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>width_height_type</parameter></methodparam>
</methodsynopsis>
<simpara>
<para>
Open a shell at the remote end and allocate a stream for it.
<parameter>term_type</parameter> should correspond to one of the entries
in the target system's <literal>/etc/termcap</literal> file and defaults to <literal>vanilla</literal>.
<parameter>env</parameter> may be passed as an associative array of name/value pairs
to set in the target environment.
</simpara>
</para>
</refsect1>
<simpara>
<parameter>width</parameter>, and <parameter>height</parameter>
define the width and height of the virtual terminal allocated for the shell process.
<parameter>width_height_type</parameter> should be one of
<constant>SSH2_TERM_UNIT_CHARS</constant> or
<constant>SSH2_TERM_UNIT_PIXELS</constant>.
</simpara>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>session</parameter></term>
<listitem>
<para>
An SSH connection link identifier, obtained from a call to
<function>ssh2_connect</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>term_type</parameter></term>
<listitem>
<para>
<parameter>term_type</parameter> should correspond to one of the
entries in the target system's <literal>/etc/termcap</literal> file
and defaults to <literal>vanilla</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>env</parameter></term>
<listitem>
<para>
<parameter>env</parameter> may be passed as an associative array of
name/value pairs to set in the target environment.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>width</parameter></term>
<listitem>
<para>
Width of the virtual terminal.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>height</parameter></term>
<listitem>
<para>
Height of the virtual terminal.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>width_height_type</parameter></term>
<listitem>
<para>
<parameter>width_height_type</parameter> should be one of
<constant>SSH2_TERM_UNIT_CHARS</constant> or
<constant>SSH2_TERM_UNIT_PIXELS</constant>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<example>
<title>Executing a command</title>
<programlisting role="php">
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Executing a command</title>
<programlisting role="php">
<![CDATA[
<?php
$connection = ssh2_connect('shell.example.com', 22);
@ -45,17 +105,22 @@ ssh2_auth_password($connection, 'username', 'password');
$stream = ssh2_shell($connection, 'vt102', null, 80, 24, SSH2_TERM_UNIT_CHARS);
?>
]]>
</programlisting>
</example>
<simpara>
See Also:
<function>ssh2_exec</function>,
<function>ssh2_tunnel</function>, and
<function>ssh2_fetch_stream</function>
</simpara>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>ssh2_exec</function></member>
<member><function>ssh2_tunnel</function></member>
<member><function>ssh2_fetch_stream</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -1,28 +1,69 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.5 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<!-- $Revision: 1.6 $ -->
<refentry id="function.ssh2-tunnel">
<refnamediv>
<refname>ssh2_tunnel</refname>
<refpurpose>Open a tunnel through a remote server</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>resource</type><methodname>ssh2_tunnel</methodname>
<methodparam><type>resource</type><parameter>session</parameter></methodparam>
<methodparam><type>string</type><parameter>host</parameter></methodparam>
<methodparam><type>int</type><parameter>port</parameter></methodparam>
</methodsynopsis>
<para>
Open a socket stream to an arbitrary host/port by way of the currently
connected SSH server.
</para>
</refsect1>
<simpara>
Open a socket stream to an arbitrary host/port by way of the
currently connected SSH server.
</simpara>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>session</parameter></term>
<listitem>
<para>
An SSH connection link identifier, obtained from a call to
<function>ssh2_connect</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>host</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>port</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<example>
<title>Opening a tunnel to an arbitrary host</title>
<programlisting role="php">
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Opening a tunnel to an arbitrary host</title>
<programlisting role="php">
<![CDATA[
<?php
$connection = ssh2_connect('shell.example.com', 22);
@ -31,16 +72,21 @@ ssh2_auth_pubkey_file($connection, 'username', 'id_dsa.pub', 'id_dsa');
$tunnel = ssh2_tunnel($connection, '10.0.0.101', 12345);
?>
]]>
</programlisting>
</example>
<simpara>
See Also:
<function>ssh2_connect</function>, and
<function>fsockopen</function>
</simpara>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>ssh2_connect</function></member>
<member><function>fsockopen</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file