namespace Fuel\Tasks; import('phpseclib/Crypt/Random', 'vendor'); import('phpseclib/Crypt/Hash', 'vendor'); import('phpseclib/Crypt/RC4', 'vendor'); import('phpseclib/Net/SSH2', 'vendor'); import('phpseclib/Net/SFTP', 'vendor'); use \PHPSecLib_Crypt; use \PHPSecLib_Net; class Billingextract { function run() { return ""; } /** * to run: * php oil refine billingextract:run_extract */ function run_extract() { require_once('fuel/core/vendor/phpseclib/Crypt/Random.php'); require_once('fuel/core/vendor/phpseclib/Math/BigInteger.php'); $filename = 'billingextract.txt'; $output ="Hello World"; $sftp = new \PHPSecLib\Net_SFTP('xxx.xxx.xxx.xxx'); if (!$sftp->login('xxxxxxx', 'xxxxxxx')) { \Cli::write('Login Failed','red'); } else { $sftp->put($filename, $output); \Cli::write('Success - '.$filename.' pushed to FTP server','green'); } return; } }
It looks like you're new here. If you want to get involved, click one of these buttons!