我想通过PHP上的代理调用SOAP方法。 WSDL路径为https://eaisto.gibdd.ru/common/ws/arm_expert.php?wsdl
我试过这样:
$url = 'https://eaisto.gibdd.ru/common/ws/arm_expert.php?wsdl';
$soap_params = array(
'stream_context' => stream_context_create(
array(
'ssl' => array(
'SNI_enabled' => false
),
'http' => array(
'proxy' => 'tcp://54.193.18.175:80'
),
)
),
'connection_timeout' => self::CONNECTION_TIMEOUT,
'proxy_host' => '54.193.18.175',
'proxy_port' => '80'
);
$gibdd_client = new SoapClient(self::GIBDD_URL, $soap_params);
$get_data_request = $gibdd_client->GetCardByVin(array());
但它不起作用。错误:
SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://eaisto.gibdd.ru/common/ws/arm_expert.php?wsdl' : failed to load external entity "https://eaisto.gibdd.ru/common/ws/arm_expert.php?wsdl"
当我使用http://eaisto.gibdd.ru/common/ws/arm_expert.php?wsdl代替https://eaisto.gibdd.ru/common/ws/arm_expert.php?wsdl时,它可以正常运行。我如何通过代理发送SOAP请求到https?
我试过
'ssl' => array(
'SNI_enabled' => false,
'verify_peer' => false,
'verify_peer_name' => false,
),
但这也行不通。
答案 0 :(得分:0)
这应该有效:
$streamContext = stream_context_create([
'ssl' => [
'verify_peer' => true,
'cafile' => <path to the CA file>,
'local_cert' => <path to your PEM cert>,
'local_pk' => <path to your private key PEM file>
]
]);
$options = [
'proxy_host' => '<your proxy host>',
'proxy_port' => <your proxy port>
'proxy_login' => '<your proxy login>',
'proxy_password' => '<your proxy password>',
'stream_context' => $streamContext
]
$soapClient = new SoapClient($wsdl, $options);
我在PHP5.4上成功做到了这一点,但是我想知道它是否仍然可以在现代版本的PHP中使用:曾经有一个错误可能会回来:https://bugs.php.net/bug.php?id=50489
还请注意,错误消息将无济于事。 例如。当代理拒绝使用 HTTP / 1.1 403 Forbidden ...的身份验证...时,我收到错误:140770FC:SSL例程:SSL23_GET_SERVER_HELLO:未知协议 ...奇怪而无益...... / p>