I am downloading some blogs in RSS format. This is an example:
<rss xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
<channel>
<title>
john doe clippingsconverter - Google Blog Search
</title>
<link>
http://www.google.com/search?hl=en&q=john+doe+clippingsconverter&tbm=blg
</link>
<description>1 result</description>
<opensearch:totalResults>1</opensearch:totalResults>
<opensearch:startIndex>1</opensearch:startIndex>
<opensearch:itemsPerPage>1</opensearch:itemsPerPage>
<item>
<title>5 Best Kindle Tips and Tricks - Make Tech Easier</title>
<link>
http://www.maketecheasier.com/5-best-kindle-tips-and-tricks/2010/10/16
</link>
<description>
<em>John Doe</em>. You can convert your clippings file to word, excel and pdf at http://www.<em>clippingsconverter</em>.com · 28th April 2011 02:53:00 Reply. Anonymous. yes, http://www.<em>clippingsconverter</em>…. is a true gem. I also use this <b>...</b>
</description>
<dc:publisher>Make Tech Easier</dc:publisher>
<dc:creator>Abhiroop Basu</dc:creator>
<dc:date>Sat, 16 Oct 2010 12:00:53 GMT</dc:date>
</item>
</channel>
</rss>
I am using this code:
$feed = file_get_contents($SearchURL);
$xml = new SimpleXmlElement($feed);
foreach ($xml->channel->item as $entry){
echo $entry->title;
echo $entry->description;
}
I get this error message:
Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: Entity: line 21: parser error : Input is not proper UTF-8, indicate encoding !
I notice the feed downloaded does not have this line at the top, which might explain the error.
<?xml version="1.0" encoding="UTF-8"?>
Thanks for your help.