PHP SoapClient get gzip wsdl

My SoapClient cannot open the gsipped wsdl file directly. Feel free to take a look at WSDL, I think its publication (https://www.ad-juster.com/api_sandbox/api/dre-api.wsdl)

I tried a bunch of settings like

$client = new SoapClient("https://www.ad-juster.com/api_sandbox/api/dre-api.wsdl", array('compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 9));

But that will not work. I also tried almost any combination of php Zlib functions and worked only with gzfile ().

This is my very hacky job, which I really don't like:

$file  = fopen('/tmp/tmp.wsdl', 'w+');
$input = gzfile('https://www.ad-juster.com/api_sandbox/api/dre-api.wsdl');
foreach ($input as $line) {
  fwrite($file, $line);
}
fclose($file);
$client = new SoapClient('/tmp/tmp.wsdl', array('location' => 'https://www.ad-juster.com/api_sandbox/api/'));

Can anyone recommend a better way to do this?

+3
source share

Source: https://habr.com/ru/post/1768712/


All Articles