Sending files to an FTP server, you can use your PC to send logs to a computer with the VPS.
PHP Code:
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Net;
using Addon;
namespace FTP
{
public class Class1 : CPlugin
{
public override void OnServerLoad()
{
var filename = "plugins//log.txt";
string ftpServerIP = "127.0.0.1";
string ftpUserID = "admin";
string ftpPassword = "12345";
string ftpPath = "/public_html/";
FileInfo fileInf = new FileInfo(filename);
string uri = "ftp://" + ftpServerIP + ftpPath + fileInf.Name;
FtpWebRequest reqFTP;
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + ftpServerIP + ftpPath + fileInf.Name));
reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
reqFTP.KeepAlive = false;
reqFTP.Method = WebRequestMethods.Ftp.UploadFile;
reqFTP.UseBinary = true;
reqFTP.ContentLength = fileInf.Length;
int buffLength = 2048;
byte[] buff = new byte[buffLength];
int contentLen;
FileStream fs = fileInf.OpenRead();
try
{
Stream strm = reqFTP.GetRequestStream();
contentLen = fs.Read(buff, 0, buffLength);
while (contentLen != 0)
{
strm.Write(buff, 0, contentLen);
contentLen = fs.Read(buff, 0, buffLength);
}
strm.Close();
fs.Close();
}
catch (Exception ex)
{
ServerPrint("[FTP Status]: " + ex.Message);
}
}
}
}