How to run wget from php so that output gets displayed in the browser window?
You can just use file_get_contents instead. Its much easier.
echo file_get_contents('http://www.google.com');
If you have to use wget, you can try something like:
$url = 'http://www.google.com';
$outputfile = "dl.html";
$cmd = "wget -q \"$url\" -O $outputfile";
exec($cmd);
echo file_get_contents($outputfile);