In C# you could first save your PHP code to a temporary file in C:\temp\ (or somewhere you specify)
Then
System.Diagnostics.Process.Start(@"C:\Program Files\Notepad++
otepad++.exe", @"C:\temp\tmpfile.php");
(I'm guessing at the file path names, change as appropriate)
Then as Võ Quang Hòa says use the FileSystemWatcher
class to watch for the file to be saved, and when it is, your program will read it and save it back to the DB.
FileSystemWatcher fsw = new FileSystemWatcher(@"C:\temp\");
fsw.Filter = "tmpfile.php";
fsw.NotifyFilter = NotifyFilters.LastWrite;
fsw.Changed += new FileSystemEventHandler(fsw_Changed);
fsw.EnableRaisingEvents = true;
and add function
private static void fsw_Changed(object sender, FileSystemEventArgs e)
{
// Code to save file to DB and delete temp file.
}