PHP 读取文件() returns 'HTTP/1.1 500 Internal Server Error'

PHP readfile() returns 'HTTP/1.1 500 Internal Server Error'

有个奇怪的问题。有一些肥皂 api: https://ctaau.vedaxml.com/cta/sys2/business-enquiry-v3-2

在浏览器中运行正常

我已经尝试

readfile('https://ctaau.vedaxml.com/cta/sys2/business-enquiry-v3-2'); 

然后我得到 HTTP/1.1 500.

但 curl 也能正常工作:

$curl = curl_init();
curl_setopt_array($curl, array(
    CURLOPT_RETURNTRANSFER => 1,
    CURLOPT_URL => 'https://ctaau.vedaxml.com/cta/sys2/business-enquiry-v3-2',
));
$resp = curl_exec($curl);
curl_close($curl);
echo $resp;

问题:你认为我可以通过 readfile() 从 api 获取 http 200 吗? file_get_contents() returns 也是 500 错误。

p.s:为什么是readfile(),却没有SoapClient:据我了解,SoapClient class将readfile()封装在里面。因此,如果我从 readfile() 获得成功,那么我将尝试为 SoapClient 找到解决方案。

如果我在浏览器中打开 https://ctaau.vedaxml.com/cta/sys2/business-enquiry-v3-2,它会给我一个 HTTP 500 错误(检查开发人员工具中的网络选项卡)。

我得到的结果是这样的:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>
        <soapenv:Fault>
            <faultcode>soapenv:Server</faultcode>
            <faultstring>Policy Falsified</faultstring>
            <faultactor>https://ctaau.vedaxml.com:8443/cta/sys2/business-enquiry-v3-2</faultactor>
            <detail>
                <l7:policyResult
                    status="Service Not Found.  The request may have been sent to an invalid URL, or intended for an unsupported operation." xmlns:l7="http://www.layer7tech.com/ws/policy/fault"/>
            </detail>
        </soapenv:Fault>
    </soapenv:Body>
</soapenv:Envelope>

查看结果状态消息

Service Not Found. The request may have been sent to an invalid URL, or intended for an unsupported operation.

在 API 上查找文档并找到正确的服务 url 或了解在使用 API 之前是否需要先进行身份验证。