Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php // Important: It is helpful to send the contents of the // sftp.LastErrorText ..
Decoded Output download
<?php
// Important: It is helpful to send the contents of the
// sftp.LastErrorText property when requesting support.
$sftp = new COM("Chilkat_9_5_0.SFtp");
// Any string automatically begins a fully-functional 30-day trial.
$success = $sftp->UnlockComponent('Anything for 30-day trial');
if ($success != 1) {
print 'error 1' . $sftp->LastErrorText . "
";
exit;
}
// Set some timeouts, in milliseconds:
$sftp->ConnectTimeoutMs = 5000;
$sftp->IdleTimeoutMs = 10000;
// Connect to the SSH server.
// The standard SSH port = 22
// The hostname may be a hostname or IP address.
$hostname = 'ftp3.breadtalk.com';
$port = 22;
$success = $sftp->Connect($hostname,$port);
if ($success != 1) {
print 'error 2' . $sftp->LastErrorText . "
";
exit;
}
// Authenticate with the SSH server. Chilkat SFTP supports
// both password-based authenication as well as public-key
// authentication. This example uses password authenication.
$success = $sftp->AuthenticatePw('Malaysia','M@lay51@');
if ($success != 1) {
print 'error 3' . $sftp->LastErrorText . "
";
exit;
}
// After authenticating, the SFTP subsystem must be initialized:
$success = $sftp->InitializeSftp();
if ($success != 1) {
print 'error 4' . $sftp->LastErrorText . "
";
exit;
}
// Open a file for writing on the SSH server.
// If the file already exists, it is overwritten.
// (Specify "createNew" instead of "createTruncate" to
// prevent overwriting existing files.)
$handle = $sftp->openFile('hamlet.xml','writeOnly','createTruncate');
if ($sftp->LastMethodSuccess != 1) {
print 'error 5' . $sftp->LastErrorText . "
";
exit;
}
// Upload from the local file to the SSH server.
$success = $sftp->UploadFile($handle,'c:/temp/hamlet.xml');
if ($success != 1) {
print 'error 6' . $sftp->LastErrorText . "
";
exit;
}
// Close the file.
$success = $sftp->CloseHandle($handle);
if ($success != 1) {
print 'error 7' . $sftp->LastErrorText . "
";
exit;
}
print 'Success.' . "
";
?>
Did this file decode correctly?
Original Code
<?php
// Important: It is helpful to send the contents of the
// sftp.LastErrorText property when requesting support.
$sftp = new COM("Chilkat_9_5_0.SFtp");
// Any string automatically begins a fully-functional 30-day trial.
$success = $sftp->UnlockComponent('Anything for 30-day trial');
if ($success != 1) {
print 'error 1' . $sftp->LastErrorText . "\n";
exit;
}
// Set some timeouts, in milliseconds:
$sftp->ConnectTimeoutMs = 5000;
$sftp->IdleTimeoutMs = 10000;
// Connect to the SSH server.
// The standard SSH port = 22
// The hostname may be a hostname or IP address.
$hostname = 'ftp3.breadtalk.com';
$port = 22;
$success = $sftp->Connect($hostname,$port);
if ($success != 1) {
print 'error 2' . $sftp->LastErrorText . "\n";
exit;
}
// Authenticate with the SSH server. Chilkat SFTP supports
// both password-based authenication as well as public-key
// authentication. This example uses password authenication.
$success = $sftp->AuthenticatePw('Malaysia','M@lay51@');
if ($success != 1) {
print 'error 3' . $sftp->LastErrorText . "\n";
exit;
}
// After authenticating, the SFTP subsystem must be initialized:
$success = $sftp->InitializeSftp();
if ($success != 1) {
print 'error 4' . $sftp->LastErrorText . "\n";
exit;
}
// Open a file for writing on the SSH server.
// If the file already exists, it is overwritten.
// (Specify "createNew" instead of "createTruncate" to
// prevent overwriting existing files.)
$handle = $sftp->openFile('hamlet.xml','writeOnly','createTruncate');
if ($sftp->LastMethodSuccess != 1) {
print 'error 5' . $sftp->LastErrorText . "\n";
exit;
}
// Upload from the local file to the SSH server.
$success = $sftp->UploadFile($handle,'c:/temp/hamlet.xml');
if ($success != 1) {
print 'error 6' . $sftp->LastErrorText . "\n";
exit;
}
// Close the file.
$success = $sftp->CloseHandle($handle);
if ($success != 1) {
print 'error 7' . $sftp->LastErrorText . "\n";
exit;
}
print 'Success.' . "\n";
?>
Function Calls
None |
Stats
MD5 | 518c6712a19212895db4a0f2e2dbbd41 |
Eval Count | 0 |
Decode Time | 79 ms |