Php calls the webservice interface, garbled characters, and errors
Source: Internet
Author: User
Php calls the webservice interface. garbled characters and error messages & lt ;? $ Client & nbsp ;=& nbsp; new & nbsp; SoapClient ('http: // www.webxml.com.cn/WebServices/TraditionalSimplifiedWebService.asmx? Ws php calls webservice interface, garbled code and Error Reporting
$ Client = new SoapClient ('http: // www.webxml.com.cn/WebServices/TraditionalSimplifiedWebService.asmx? Wsdl ');
$ Client-> soap_defencoding = 'utf-8 ';
$ Client-> decode_utf8 = false;
$ Obj = $ client-> toTraditionalChinese (array ('stext '=> '));
Print_r ($ obj );
?>
This is a webservice code that I wrote to call the web Public simple conversion, I have specified soap_defencoding as the UTF-8, decode_utf8 is set to false, but after the execution of the prompt [Encoding: string '\ xb8... 'is not a valid UTF-8 string]
Please help us to see how to deal with this:
------ Solution --------------------
Encoding: string '\ xb8...' is not a valid UTF-8 string
The passed parameter is not a UTF-8 string
That is to say, your array ('stext '=>' is not UTF-8
That is to say, your program file is not UTF-8
However, if it is UTF-8, why should we declare the character set?
In addition
$ Client-> soap_defencoding = 'utf-8 ';
$ Client-> decode_utf8 = false;
Is the method of nusoap
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service