Jump to content

bob33_14

New Members
  • Posts

    3
  • Joined

  • Last visited

bob33_14's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Your right; I just looked at the phpinfo() and DOM is available with libxml; thank you for the help. Is there a good tutorial, that you might suggest for DOMDocument object?
  2. Yeah, I looked into that, but I am using a web host that will not let me install other extentions (like libxml). So I am trying to push the keys into dynamic array with explode. It works on other xml nodes (that have a consistant representation, throughout the xml document), but no so much on no exsistant nodes. Is the another way to go about this? So far, I have tried checking the strlen() of $img2[0] (in a if...else condition); but that did not seem to work.
  3. I am scrapping an xml feed with the file_get_contents() and explode() function. Some the xml nodes do not exsist; so I am getting an inconsistant array from a for() loop. What would be the best way to keep an array key, created from an explode() function; empty, if there is no corresponding xml node to be scrapped? Currently, when I use the code below; I get all the node's content (that exsisit within the xml document) at the top and then, at the bottom; I get all the empty node's content or basically a empty/blank area. What I am getting is this: pic1.jpg<br/> pic3.jpg<br/> pic5.jpg<br/> <br/> <br/> And... what I want to get is this: pic1.jpg<br/> <br/> pic3.jpg<br/> <br/> pic5.jpg<br/> Here is my XML code (syndicate.xml): <?xml version="1.0" encoding="iso-8859-1"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:enc="http://purl.oclc.org/net/rss_2.0/enc#" xmlns:ev="http://purl.org/rss/1.0/modules/event/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:admin="http://webns.net/mvcb/" > <item> <enc:enclosure resource="pic1.jpg" type="image/jpeg"/> </item> <item> </item> <item> <enc:enclosure resource="pic3.jpg" type="image/jpeg"/> </item> <item> </item> <item> <enc:enclosure resource="pic5.jpg" type="image/jpeg"/> </item> </rdf:RDF> And... here is my PHP code: <?php $rss = file_get_contents("syndicate.xml"); $img = explode("enclosure resource=\"",$rss); for($key = 0; $key < 5; $key++){ $img2 = explode("\"",$img[$key+1]); echo $img2[0]."<br/>\n"; } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.