【问题标题】:Daily download of an external hosted and password protected xml file to our webserver - http每天将外部托管和受密码保护的 xml 文件下载到我们的网络服务器 - http
【发布时间】:2016-09-28 14:38:56
【问题描述】:

这与下面的问题基本相同,但在我们的例子中,源是受密码保护的(用户名和密码)

Daily XML's download to webserver from fixed external URL's

这可以通过http实现吗?

如何编码这些东西?

【问题讨论】:

    标签: php xml http


    【解决方案1】:

    需要什么类型的身份验证?如果有 Apache 的基本身份验证,那么您可以通过以下方式编写 URL 来自动登录:

    http://user:password@host.com/file.xml

    简单的php示例:

    <?php 
    $content = file_get_contents('http://user:password@host.com/file.xml');
    ?>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-26
      • 1970-01-01
      • 1970-01-01
      • 2014-03-29
      • 1970-01-01
      相关资源
      最近更新 更多