ssh2_tunnel

(PECL ssh2 >= 0.9.0)

ssh2_tunnelUzak bir sunucuya doğru bir tünel açar

Açıklama

ssh2_tunnel(resource $oturum, string $konak, int $port): resource

Bağlı bir SSH sunucusu üzerinden belirtilen konak ve porta bir soket akımı açar.

Değiştirgeler

oturum

ssh2_connect() ile sağlanan bir SSH bağlantı tanıtıcısı.

konak

port

Dönen Değerler

Örnekler

Örnek 1 - Belli bir konağa bir tünel açmak

<?php
$baglanti 
ssh2_connect('shell.example.com'22);
ssh2_auth_pubkey_file($baglanti'kullanıcı''id_dsa.pub''id_dsa');

$tunel ssh2_tunnel($baglanti'10.0.0.101'12345);
?>

Ayrıca Bakınız

add a note add a note

User Contributed Notes 1 note

up
0
marc
8 years ago
ssh2_tunnel returns a socket stream (e.g, the output of fsockopen). You can use something basic like this to send a line break and get any output back to test that it's working:

fwrite($tunnel, "\n");
while (!feof($tunnel)) {
      echo fgets($tunnel, 128);
}

Just a reminder: you can't currently use the socket with any of the cURL functions.
To Top