how do i parse an xml page to output its data pieces to the way i want?

Posted by ida on Stack Overflow See other posts from Stack Overflow or by ida
Published on 2010-04-10T22:59:19Z Indexed on 2010/04/10 23:03 UTC
Read the original article Hit count: 287

Filed under:
|
|
|

here is the page i want to parse (the api link i gave is just a dev test so its ok to be public) http://api.scribd.com/api?method=docs.getList&api_key=2apz5npsqin3cjlbj0s6m

the output im looking for is something like this (for now)

 Doc_id: 29638658
 access_key: key-11fg37gwmer54ssq56l3
 secret_password: 1trinfqri6cnv3gf6rnl
 title: Sample
 description: k
 thumbnail_url: http://i6.scribdassets.com/public/images/uploaded/152418747/xTkjCwQaGf_thumbnail.jpeg
 page_count: 100

ive tried everything i can find on the internet but nothing works good. i have this one script

<?php
$xmlDoc = new DOMDocument();
$xmlDoc->load("http://api.scribd.com/api?method=docs.getList&api_key=2apz5npsqin3cjlbj0s6m");

$x = $xmlDoc->documentElement;
foreach ($x->childNodes AS $item) {
  print $item->nodeName . " = " . $item->nodeValue;
 }



 ?>

its output comes out like this:

#text = 
  resultset = 

      29638658
      key-11fg37gwmer54ssq56l3
      1trinfqri6cnv3gf6rnl

        Sample


        k

      http://i6.scribdassets.com/public/images/uploaded/152418747/xTkjCwQaGf_thumbnail.jpeg

        DONE

      100


      29713260
      key-18a9xret4jf02129vlw8
      25fjsmmvl62l4cbwd1vq

        book2


        description bla bla 

      http://i6.scribdassets.com/public/images/uploaded/153065528/oLVqPZMu3zhsOn_thumbnail.jpeg

        DONE

      7

  #text = 

i need major help im really stuck and dont know what to do. please please help me. thnx

© Stack Overflow or respective owner

Related posts about php

Related posts about xmlparser