This article mainly introduces the processing method of php to obtain xml interface data. It has certain reference value. Now I share it with you. Friends in need can refer to it
xml The format of the data returned is generally like this, but there are also differences:
Generally, xml is directly used in PHP:simplexml_load_string();is parsed into an array, but when I parse it, it prompts: There is data encoding that cannot be parsed.
That’s the part where the data is garbled. I used the header statement to solve the garbled code, but it didn’t work. Finally I used:
iconv('utf-8' ,'gbk',$a);
To solve the problem, transcode first, then parse
and finally json conversion.
Related recommendations:
Detailed explanation of the three methods of php to obtain POST data
PHP Get user behavior [IP/OS/URL/ Broswer] Reference code
The above is the detailed content of php processing method for obtaining xml interface data. For more information, please follow other related articles on the PHP Chinese website!