Parsing XML

  • (2 Pages)
  • +
  • 1
  • 2

18 Replies - 2192 Views - Last Post: 16 February 2012 - 11:30 AM Rate Topic: -----

#16 ronxiel_newbie   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 33
  • Joined: 12-April 11

Re: Parsing XML

Posted 15 February 2012 - 01:31 PM

Thank you very much CTphpnwb.
How newbie am I, I only forgot to put an (.) after the declaration of new variable earlier.

$content .= ...
The single period saves me... Thanks a Lot.
Was This Post Helpful? 0
  • +
  • -

#17 JackOfAllTrades   User is offline

  • Saucy!
  • member icon

Reputation: 6260
  • View blog
  • Posts: 24,030
  • Joined: 23-August 08

Re: Parsing XML

Posted 15 February 2012 - 03:26 PM

Sorry, guess I misunderstood what the problem was.
Was This Post Helpful? 0
  • +
  • -

#18 ronxiel_newbie   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 33
  • Joined: 12-April 11

Re: Parsing XML

Posted 16 February 2012 - 11:01 AM

Thats ok Mr. JackOfAllTrades, you have help me so much... Thank you very much.. Just continue helping and more powers.
Was This Post Helpful? 0
  • +
  • -

#19 ronxiel_newbie   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 33
  • Joined: 12-April 11

Re: Parsing XML

Posted 16 February 2012 - 11:30 AM

Hi, sorry for this. I have a follow-up problem. this also related on my original question.

I have successfully running the function and now I'm facing another problem,

what if I have a couple of keywords that must be use to query into the xml link.
example of 5 keywords;(keyword1,keyword2,keyword3,keyword4,keyword5)

$key = explode(",",$keywords);
	foreach($key as $new_keywords){
        

$db_content=$new_keywords;
$doc_db = new DOMDocument();
  $doc_db->load('http://sample_website.com/api/quertstring='.$db_content.'');
  $arrFeeds_db = array();
  foreach ($doc_db->getElementsByTagName('Result') as $node_db) {
    $itemRSS_db = array ( 
      'title' => $node_db->getElementsByTagName('Label')->item(0)->nodeValue,
      'desc' => $node_db->getElementsByTagName('Description')->item(0)->nodeValue,
      'link' => $node_db->getElementsByTagName('URI')->item(0)->nodeValue,
      'date' => $node_db->getElementsByTagName('pubDate')->item(0)->nodeValue
      );
    array_push($arrFeeds_db, $itemRSS_db);  
   $new_db_content .='<a href='.$itemRSS_db['link'].'>'.$itemRSS_db['title'].'</a><br/>'.$itemRSS_db['desc'].'';
  }

//RESULTS
echo $new_db_content;
      }



The problem on it is that the keyword1 rss results is also displayed in all of the other. Can anyone help me to solve this? Thanks in advance.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2