How to use wget in php?

后端 未结 10 2036
离开以前
离开以前 2020-12-04 14:24

I have this parameters to download a XML file:

wget --http-user=user --http-password=pass http://www.example.com/file.xml

How I have to use

10条回答
  •  余生分开走
    2020-12-04 15:23

    Shellwrap is great tool for using the command-line in PHP!

    Your example can be done quite easy and readable:

    use MrRio\ShellWrap as sh;
    
    $xml = (string)sh::curl(['u' => 'user:pass'], 'http://example.com/file.xml');
    

提交回复
热议问题