I'm a newbie here, but I'll try to describe my problem as best as I can.
Basically I have been trying to trigger an automated SFTP upload of a screenshot file whenever someone completes an order on my client's site. This is for a review of the application that has been done. I am using phpseclib as the primary way to upload the file. Unfortunately I get a timed out error whenever I connect it to the other host server. If I point it on its own server, the upload works. So everything from the code below is working when we upload files through sftp into its own server. If it is a different one, it will time out. The php is below. NOTE that I swapped the file upload, to just a creation of a txt file for testing, same results, still timing out.
ini_set('include_path', '/usr/local/lib/custom_php/phpseclib');
include('Net/SSH2.php');
include('Net/SFTP.php');
define('NET_SFTP_LOGGING', NET_SFTP_LOG_COMPLEX);
$username = "user";
$password = "password";
$host = "ftp.the3rdpartyserver.com";
$sftp = new Net_SFTP($host);
$sftp->setTimeout(1000);
$sftp->fsock = 1000;
if (!$sftp->login($username, $password)) {
exit('login failed again');
};
//$sftp->put($remote_file, $local_file, NET_SFTP_LOCAL_FILE);
//$sftp->put($remote_file, "imagetemp.png", NET_SFTP_LOCAL_FILE);
$sftp->put('filename.txt', "xxx");
print_r($sftp->getSFTPErrors());
echo $sftp->getSFTPLog();
The error that I get would be:
Error 110. Connection timed out in <b>/usr/local/lib/custom_php/phpseclib/Net/SSH2.php</b> on line <b>966</b><br /> login failed again<br /> <b>Notice</b>: Connection closed prematurely in <b>/usr/local/lib/custom_php/phpseclib/Net/SSH2.php</b> on line <b>3143</b><br /> <br /> <b>Warning</b>: fclose() expects parameter 1 to be resource, boolean given in <b>/usr/local/lib/custom_php/phpseclib/Net/SSH2.php</b> on line <b>3379</b><br />
In our testing, they told me that they have adjusted the timeout length already, but this is still the result. I also tested different accounts for the sftp, and I have the same result. I also tried if I can set the timeouts to a longer time, but no effect. Any help will be greatly appreciated. Thank you very much! :)