0

hi i am trying to collect the database of books from the devloper area
of isbndb.com. this site provide us a passkey with the help of that we can collect the xml data from database depending upon criterias.

.http://isbndb.com/api/books.xml?access_key=6XEB6RTL&index1=publisher_id&value1=oreilly
this link collect the xml data of books publisher of oreilly.

then i use php code
like

<?php 
            $requestAddress = "http://isbndb.com/api/books.xml?access_key=6XEB6RTL&index1=publisher_id&value1=oreilly"; 
    $xml_str = file_get_contents($requestAddress,0);
    print "<br />$xml_str<br />";

?>

to fetch xml data as text format.
my problem is that this fetch data is like a paragraph,and very tough to distinguish the records.

please help me to change this php code so the data is look like records.
or if possible is there is any way to use those data directly to tha database??????

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by __avd
0

hi thanks for reply.
but i am a beginner in php.so it is very herd to understand for me with out examples.
plz give me some example description .
plz help me...

0

I presume that the content of xml file stored in $xml_str would be like this :

<?xml version="1.0" ...>
  <Students>
    <Record No="1">
      <Name>Mr.X</Name>
      <GrNo>11</GrNo>
   </Record>
   ....
 </Students>
<?php 
       $requestAddress = "http://isbndb.com/api/books.xml? 
                   access_key=6XEB6RTL&index1=publisher_id&value1
                                    =oreilly"; 
    $xml_str = file_get_contents($requestAddress,0);
    print "<br />$xml_str<br />";

   $s = simplexml_load_string($xml_str);
  print $s->Record->Name;
  print $s->Record->GrNo;
  print $s->Record["No"]; // Attribute

  foreach($s as $rec) {
    print "<br/>" . $rec[0] .  '   '  .  $rec[1]
 }
?>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.