-
Notifications
You must be signed in to change notification settings - Fork 0
/
testConnection.php
62 lines (47 loc) · 1.36 KB
/
testConnection.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
set_include_path(__DIR__ . '/../contents/phpseclib0.3.10/');
define('flag', TRUE);
include (__DIR__ . '/../contents/dtypes.php');
include('db.php');
require_once('Crypt/RSA.php');
require_once('Net/SSH2.php');
require_once('Net/SCP.php');
$db = new Database(key9, key10, key11, key12);
$db->connect();
$db->select("results", "batch_directory", "jobName='lims-project-test-non-real-data-no-1'");
$res = $db->getResult();
//$remotef = $res['batch_directory'] . '/last.2.pdb';
$remotef = '/pica/h1/fredrw/private/project/A-37-M/last.2.pdb';
//echo $remotef . "<br>";
$localf = __DIR__ . '/temp/last.2.pdb';
//echo $localf . "<br>";
$ssh_conn = new Net_SSH2(key5);
if(!$ssh_conn->login(key8, key6)){
echo "SSH: Fail to login.<br>";
}
$scp = new Net_SCP($ssh_conn);
if(!$scp->get($remotef, $localf)){
echo "SCP: Fail retrieving file.<br>";
}
else {
echo "Successful File Transfer.<br>Path: " . $localf . "<br>";
}
if($ssh_conn->isConnected()){
$ssh_conn->disconnect();
}
$db->disconnect();
/*
$ssh_conn = ssh2_connect(key5, key7);
if(!$ssh_conn){
echo "Can't connect SSH.<br>";
}
if(!ssh2_auth_password($ssh_conn, key8, key6)){
echo "SSH Connection Failure.<br>";
}
$filetr = ssh2_scp_recv($ssh_conn, $remotef, $localf);
if(!$filetr){
echo "Error transfering file.<br>";
}
$ssh_conn->disconnect();
*/
?>