Skip to content

Instantly share code, notes, and snippets.

View charlesharries's full-sized avatar

Charles Harries charlesharries

View GitHub Profile
@charlesharries
charlesharries / sftp.php
Created September 12, 2018 20:58
Download a file over SFTP with PHP and phpseclib
<?php
// Configure phpseclib
// Go download it from http://phpseclib.sourceforge.net/index.html and extract it
set_include_path(get_include_path() . PATH_SEPARATOR . '/full/path/to/phpseclib');
include('Net/SFTP.php');
include('Crypt/RSA.php');
// Load config, which is in its own file, since I'm a good security boy
$config = json_decode(file_get_contents('config.json'));