PHP to read secured file

前端 未结 2 1036
一整个雨季
一整个雨季 2021-01-19 05:46

I have a xml-file on subdomain a, and a php script on subdomain b. I want to read, and use, the data from the XML file, through PHP.

Here\'s the catch. The file is s

2条回答
  •  无人及你
    2021-01-19 06:34

    Unless you need the advanced versions of cURL (which is less necessary these days IMO) you can just start the filename with 'http://user:password@example.com' whereever you read the XML file and it should work pretty transparently. It will use a blocking connection, so your script will pause while it waits for a response.

    $xdocument = simplexml_load_file('http://user:password@subdomain.example.com/thexmlfile.xml');
    

提交回复
热议问题