Home > Backend Development > PHP Tutorial > simplexml parsing error in php5_PHP tutorial

simplexml parsing error in php5_PHP tutorial

WBOY
Release: 2016-07-15 13:22:33
Original
949 people have browsed it

I used simplexml to parse an RSS data source a while ago, and I easily got the results I wanted. I didn’t want to start reporting errors within a few days:

Warning: simplexml_load_file() [function.simplexml-load- file]: input conversion failed due to input error, bytes 0xAD 0xB5 0x3C 0x2F

At first I thought it was a bug in php5, but a search found that it was possible that the RSS source was mixed with characters of other encodings, causing simplexml parsing Error.

That is to say, if the RSS declaration is like this:

PLAIN TEXTXML:

Then the RSS content must be gb2312.

Solution

Use iconv to convert the encoding

Change the encoding to the correct encoding


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446977.htmlTechArticleA while ago, I used simplexml to parse an rss data source, and got the desired results easily. It didn’t take long. Errors have been reported since the beginning of the day: Warning: simplexml_load_file() [function.simplexml-load-file]:...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template