PHP ssh2_tunnel: die Verwendung von proxy/socks-werfen ssh-server?

Möchte ich mit proxy/socks werfen ssh-server und ich fand ein schönes Beispiel von hier Wie Sie die proxy-allerdings einen server mit ssh (Socken...) mit Hilfe von php ' s CURL? aber Beispiel nicht funktionieren, hier ist mein code.

<?php
$connection = ssh2_connect("64.246.126.25", 22);
if(ssh2_auth_password($connection, "ubnt", "ubnt"))
{
    if ($tunnel = ssh2_tunnel($connection, "127.0.0.1", 9999))
    {
        $url = "http://checkip.dyndns.com/";
        $agent= 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)';
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_HEADER, true);
        curl_setopt($ch, CURLOPT_USERAGENT, $agent);
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_PROXY, "127.0.0.1:9999");
        curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
        $result = curl_exec($ch);   
        echo $result;

    }else{
        echo "Tunnel creation failed.\n";
    }
} 
else
{
    echo "failed!";
}
?>

Wenn ich excute dieses Skript habe ich Fehler Antwort:

Warning: ssh2_tunnel() [function.ssh2-tunnel]: Unable to request a channel from remote host in /home/domain.com/ssh2/index.php on line 7
Tunnel creation failed. 

Werde ich mal gegoogelt für diesen Fehler und versucht zu beheben, kann aber Probleme nicht lösen.

Jemand kann mir helfen?

InformationsquelleAutor vietnguyen09 | 2014-03-31
Schreibe einen Kommentar