User Tools

Site Tools


en:faq

Other - FAQ

Retrieving tracking data via sFTP

Example using libssh2:

<?php
$connection = ssh2_connect('tracking.pdi.elanders-germany.com', 22);
ssh2_auth_password($connection, 'USERNAME', 'PASSWORT');

$sftp = ssh2_sftp($connection);

$handle = opendir("ssh2.sftp://$sftp/./");
echo "Directory handle: $handle\n";
echo "Entries:\n";
while (false != ($entry = readdir($handle))){
    echo "$entry\n";
}

… then use a loop with ssh2_scp_recv to retrieve the data …

… and then delete the file with ssh2_sftp_unlink.

Alternative using phpseclib:

http://phpseclib.sourceforge.net

Public Key

Create the RFC 4716 version of the public key using ssh-keygen
ssh-keygen -e -f ~/.ssh/id_dsa> ~/.ssh/id_dsa_com.pub

Store the key on the server here:
File: ~/.sftp/authorized_keys

Max. Connection to PDI sFTP servers

MaxClients 2000
MaxClientsPerHost 5
MaxClientsPerUser 15
MaxHostsPerUser 1000
en/faq.txt · Last modified: 2019/04/08 16:35 (external edit)