parse posts

PHP Parser for RSS Feed From WordPress.com

I’ve been working on my own site a bit since getting out of school. I’ve been pulling an RSS feed from this blog onto my homepage for a while now, using something based off of this script. I try to keep the markup valid. The feed has given me a bit of troubles for valid markup, mainly with escaping ampersands. One problem was that I was using this function:

function pagFixRSSEncoding($argString){
    return mb_convert_encoding($argString,'HTML-ENTITIES', 'UTF-8');
}

which I had gotten from somewhere. I’m not sure what it does, but it seems to do nothing for me. I removed it, though I’ll reinstate it or look for something else if characters other than ampersands give me trouble.

I was also using this function:

function pagFixLinks($argString){
    return str_replace("&", "&", $argString);
}

to fix the ampersands in the “link”. This simply replaces all ampersands with the proper HTML entity in the passed string, works just fine.

Continue reading post "PHP Parser for RSS Feed From WordPress.com"