0
I’m trying to use the phpseclib to download with php 5.3.
yet I’m not getting it to work.
my test is this code:
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<?php
// include './phpseclib/Net/SFTP.php';
use \phpseclib\Net\SFTP;
$sftp = new SFTP('192.168.0.65');
if (!$sftp->login('oracle', '142536')) {
exit('Login Failed');
}
echo $sftp->pwd() . "\r\n";
$sftp->put( '/home/oracle/teste.txt','./teste.txt',$sftp::SOURCE_LOCAL_FILE);
$texto = $sftp->get('/home/oracle/teste.txt');
echo $texto;
?>
</body>
</html>
Yet always returns :
( ! ) Fatal error: Class 'phpseclib\Net\SFTP' not found in C:\workspace\ssh_php\index.php on line 17
Call Stack
# Time Memory Function Location
1 0.1068 127552 {main}( ) ..\index.php:0
How do I recognize the namespace in a structured code?
Using include didn’t work because dependencies were asking to be included. I researched about this autoload and got this function that solved me spl_autoload_register(Function($class_name) { include $class_name . '. php'; });
– HagaHood
@Hagahood, where did you get this lib? I thought they didn’t use namespace.
– Guilherme Nascimento
github https://github.com/phpseclib/phpseclib
– HagaHood
@Cool hagahood, are using namespaces in this version, should be a Fork.
– Guilherme Nascimento