I have a CakePHP site for a client, but with the sites blog run on Wordpress (I just redirect to the WP site for the blog). The client now wants a section of the homepage to pull in a snippet from the blog and I am wondering what is the best way to do this. I am currently trying this...
function getPosts($feed_url) { $content = file_get_contents($feed_url); // get XML string $feed_object = new xml($content); // load XML string into object $x = new SimpleXmlElement($content); // load XML string into object } getPosts("example.com"); The 'file_get_content' is working great and actually pulling in the html but I cannot get that html into xml. My error message is 'String could not be parsed as XML'. Anyone know the best way to go about this?
No comments:
Post a Comment