martho
August 12th, 2009, 08:07 AM
Hello!
I want to call a php-script out of a C#-Application and get the output of the php-script as result:
// Call PHP
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = sPathToPhp+"php.exe";
proc.StartInfo.Arguments = sScript + " " + sParameter;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.CreateNoWindow = true;
proc.Start();
proc.WaitForExit();
String sOutput = proc.StandardOutput.ReadToEnd();
proc.Close();
This works fine in XP, but in Vista, sOutput keeps empty - any ideas what could be wrong?
I want to call a php-script out of a C#-Application and get the output of the php-script as result:
// Call PHP
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = sPathToPhp+"php.exe";
proc.StartInfo.Arguments = sScript + " " + sParameter;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.CreateNoWindow = true;
proc.Start();
proc.WaitForExit();
String sOutput = proc.StandardOutput.ReadToEnd();
proc.Close();
This works fine in XP, but in Vista, sOutput keeps empty - any ideas what could be wrong?