gpt4 book ai didi

php - NuSOAP 和内容类型

转载 作者:可可西里 更新时间:2023-11-01 12:48:03 24 4
gpt4 key购买 nike

无法弄清楚如何使 NuSOAP 使用 UTF-8 作为内容类型。它不断吐出“ISO-8859-1”。这是我尝试过的相关代码位:

$soapclient=new soapclient($url1,'wsdl');
$soapclient->http_encoding='utf-8';
$soapclient->defencoding='utf-8';

if($soapclient->fault){
$retdata=$soapclient->fault;
}else{
if($soapclient->getError()){
$retdata=$soapclient->getError();
}else{
$params=array($xmldata);
$retdata=$soapclient->call($doit,$params,$url1,$url2);
}
}

请求如下:

POST xxxxxxxxxxxx HTTP/1.0
Host: xxxxxxxxxxxxx
User-Agent: NuSOAP/0.9.5 (1.123)
Content-Type: text/xml; charset=ISO-8859-1
SOAPAction: "xxxxxxxxxxxxxxxxx"
Content-Length: 1629

我什至进入了 nusoap.php 并更改了几行硬编码了 ISO 的行。我错过了什么?

最佳答案

尝试:

$soapClient->soap_defencoding = 'UTF-8';
$soapClient->decode_utf8 = false;

还要确保您发送的是 utf8 编码数据,否则会有点矛盾。 (utf8_encode()).

关于php - NuSOAP 和内容类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5317858/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com