Jump to content
  • 0
Sign in to follow this  
Followers 0

[PHP] XML Parsing Script


Question

Posted

For anyone that might have experienced this problem before, I'm trying to import my Wordpress feed into a website using a PHP XML parsing script... well that is the intention. I've Googled to try and find something that is relevant to my interests but to no avail, most of the scripts I've found don't particularly deliver what I need. I was hoping for something that pulls in the title of the latest post, the featured image and x amount of characters from the start of the post, all of it posted in html with customisable tags.

I'm not the most skilled PHP programmer (still learning), and I've spent hours trying to get it to work so this is a last resort really. Any help would be greatly appreciated.

Share this post


Link to post
Share on other sites

7 answers to this question

  • 0

Posted

Hope this will help you it is a tut I used to figure out how to parse a feed for my site.

[url="http://www.kirupa.com/web/xml_php_parse_intermediate.htm"]http://www.kirupa.co...ntermediate.htm[/url]

Share this post


Link to post
Share on other sites
  • 0

Posted

I've tried the beginners script, it worked but not to the full functionality that I needed, got stuck with the intermediate one. It just wouldn't open my feed at all! I downloaded the feed saved it as xml_intermediate.xml it just output the html at the end of the script.

Share this post


Link to post
Share on other sites
  • 0

Posted

fyi
http://www.smoothfinancial.co.uk/sandbox/
[url="http://www.smoothfinancial.co.uk/sandbox/xml_intermediate.xml"]http://www.smoothfin...ntermediate.xml[/url]
[url="http://www.smoothfinancial.co.uk/index.txt"]http://www.smoothfin...co.uk/index.txt[/url]

Share this post


Link to post
Share on other sites
  • 0

Posted

can you post the code your using from the intermediate tut thats not working.

Share this post


Link to post
Share on other sites
  • 0

Posted

If you want to make XML with PHP really, really easy, forget using XML Parser and use [url="http://us2.php.net/manual/en/book.simplexml.php"]SimpleXML[/url] instead.

Share this post


Link to post
Share on other sites
  • 0

Posted

[quote name='HeyRatFans' timestamp='1328907692' post='594646628']
If you want to make XML with PHP really, really easy, forget using XML Parser and use [url="http://us2.php.net/manual/en/book.simplexml.php"]SimpleXML[/url] instead.
[/quote]

Another vote for SimpleXML.

Share this post


Link to post
Share on other sites
  • 0

Posted

for anyone that is interested I ended up solving this using this persons contribution [url="http://www.corvidworks.com/articles/wordpress-content-on-other-pages"]http://www.corvidwor...-on-other-pages[/url]

really clever and simple, I recommend it if anyone finds themselves needing this kind of solution

[code]

<?php
// Include WordPress
define('WP_USE_THEMES', false);
require('../blog/wp-load.php');
query_posts('showposts=1');
?>
<?php while (have_posts()): the_post(); ?>

<?php endwhile; ?>
<?php while (have_posts()): the_post(); ?>
<h2><?php the_title(); ?></h2>
<?php the_excerpt(); ?>
<p><a href="<?php the_permalink(); ?>">Read more...</a></p>
<img src="<?php featured_image(); ?>">
<?php endwhile; ?>
[/code]
1 person likes this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.