How to run wget from php so that output gets displayed in the browser window?

后端 未结 4 2226
南方客
南方客 2021-02-08 05:47

How to run wget from php so that output gets displayed in the browser window?

4条回答
  •  时光取名叫无心
    2021-02-08 06:05

    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);
    

提交回复
热议问题