Fwd: Re: lib ssh2 functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Saturday 14 May 2005 02:16, Oscar Gosdinski wrote:
> Hello everybody:
>
> I need my PHP application connects through SSH to other server for
> getting some info to display and i tried the following code to test
> lib ssh2:
>
> $server = ...;
> $user = ...;
> $passwd = ...;
>
> $con = ssh2_connect($server, 22);
> if (ssh2_auth_password($con, $user, $passwd)) {
>        $s = ssh2_exec($con, 'ls -l');
>        $file = fopen("/tmp/test", "w");
>        while ($line = stream_get_line($s, 1024)) {
>                fwrite($file, $line);

Comment the following line.

>                fflush($file);
>
:-)
:
>        }
>        fclose($file);
> } else {
>        echo "Authentication Error";
> }
>
> The file /tmp/test was created but it does not have any data. I can
> connect to the server using a normal ssh session in my laptop and the
> 'ls -l' command returns me information.
> I think that i installed correctly the ssh2 functions because if a put
> an incorrect password i get the "Authentication Error" message.
>
> I searched the web for info about similar problems and no results.
> Please, anyone can help me with this problem because i have been
> spending three days with this.
>
> Thanks in advance for your answers.
>
> --
> Saludos / Regards
> Oscar

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436

Attachment: pgpXWJ1HE7lyV.pgp
Description: PGP signature


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux