PDA

View Full Version : start command alternative in exec ()



tuffy
09-14-2011, 06:22 PM
Hello,
In a PHP file, I send the text in a textarea to another PHP file named test.php. The context sent to the test.php file is also PHP code. I want to execute test.php file and show the result to the user in another tab of the browser. The code is like this:


<?php
if (isset($_POST['kod_calistir'])){
$kod = $_POST['kod_yazim_alani']; // take text from textarea
$fd = fopen("c:\\xampp\\htdocs\\tez\\test.php", "w+") or die("Can't open file $filename");
$fout = fwrite($fd, $kod);
fclose($fd);
exec ('start http://localhost/tez/test.php/');
}
?>

I do not want to use "start" command inside exec() to be platform independent. As far as I know, "start" command can only be used on Windows OS. I tried


header("Location: http://localhost/tez/test.php"); // OR
system ("http://localhost/tez/test.php/"); // OR
passthru ("http://localhost/tez/test.php");
instead of


exec ('start http://localhost/tez/test.php/');
but I was sucessless. Neither of the three did the same thing as exec-start code combination. Any suggestions will much be appreciated.
Thank you.