hiya i have this code below to execute cvs log within php:
//execute cvs log
$cvslogfixed ="C:/Program Files/GNU/WinCvs 1.2/cvs log ";
$logcommand="$cvslogfixed.$file";
$logfile=("C:/logresults/logresults.txt");
@ $fp = fopen($logfile, "w");
//open file for reading and writing the @ suppresses errors created by PHP
if (!fp)
{
echo "The log file cannot be located";
exit;
}
exec ($logcommand, $results);
fwrite($logfile, $results);
if (!fwrite($logfile, $results))
{
print "Cannot write to file ($logfile)";
exit;
}
while (!feof($fp))
{
$results =fgets($fp, 100);
echo $results;
}
fclose($fp);
The file is created but nothing is written into the file. My logic is every line created by $logcommand will be stored in $results. But how can I extract these lines into the $logfile.
Can anyone suggest a simple example to make sure exec command works with say a simple command like the msdos "dir"
which may help me to understand what im doing wrong.
Thanks for help in advance.