It works! I was a bit annoyed that the wordpress atom feed was only XML based. However, I do consider myself pretty good at googling things, and so I found this PHP library called “SimpleXML” which solved a LOT of stuff for me.
I used to display the first five Blogger titles on the homepage in a simple list with links. It was great. I could pass in a “format”=>”json” array in the post request and get the page contents through php-curl. Now with the migration, that functionality partially broke.
Not only did I have to change the URL for the blog feed, but I could not get a json table out of it. And thus, it was necessary to find something that could easily parse the standard XML.
My solution was:
$response = preg_replace("/<!\[CDATA\[(.*)\]\]>/","$1",curl_get("https://website/blog/feed/atom")); $xml = simplexml_load_string($response); $json = json_encode($xml); $js = json_decode($json,TRUE);
Now you may think this a little overly complex, especially since I’m taking one array ($xml) and encoding it into a json string, and then back out to a second array. However, simplexml decided to make these library-specific object types which I was not able to reference from just straight PHP. So the double conversion is necessary. (I mean, try it. Run echo “<pre>”; print_r($xml); echo “</pre>” and see what YOU get!)
Plus that cdata stuff was really getting in the way as far as screwing around with the actual text of each feed item. I found this link from coderwall that explained the preg_match thing nicely for this situation, and it worked outright.
Anyway, it works, and although the amount of data I get out is quite mind-blowing, I only want titles and link URLs, so my code has remained quite short on the front page!
Oh, and by the way, the website now has a favicon.
Plus I went through both WordPress Redirection logs AND Google Webmaster Tools 404 logs and found a bunch of stuff that Google had indexed from Blogger which was generating 404s in WordPress. I think everything is cleaned up (only two or so legitimate permalinks were broken; the rest were stupid GET variables that WP wasn’t ignoring and other things like search pages).
But I’ll give it a few days and see if anything else crops up.