Hi guys. Okay, well I've been at this for a while and I cannot seem to figure it out. Basically, I have a simpleXML PHP file that I'm trying to"parse" (I guess it's called). All I want to do is get some info from an API XML site and display it on my site.

Anyways, I have this code and my page is blank. Please help?

<?php
$html = "";
$url = "http://isbndb.com/api/books.xml?access_key=MCIJARNT&index1=isbn&value1=9780439023528";
$xml = simplexml_load_file($url);
for($i = 0; $i < 10; $i++){

    $title = $xml->Title[$i];
    $html .= "<h1>$title</h1>";

}
echo $html;
?>

Recommended Answers

$html = "";
$url = "http://isbndb.com/api/books.xml?access_key=MCIJARNT&index1=isbn&value1=9780439023528";
$xml = simplexml_load_file($url);
//for($i = 0; $i < 10; $i++){
    echo $xml->BookList->BookData->Title;
//}
echo $html;

there's only one entry

Jump to Post

All 4 Replies

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.