766Part IVConnectionsListing 41-1(continued) // Load up the xml (Sex offenders web site)

766Part IVConnectionsListing 41-1(continued) // Load up the xml file into memory$dom = new DomDocument; if (!$dom->load($writefile)) { echo Cannot load XML file ; exit; } // Get an immediately available edition$editions = $dom->getElementsByTagname( Availability ); foreach ($editions as $edition_obj) { if ($edition_obj->nodeValue == Usually ships within 24hours ) { // Get the data for this book$book_array = array(); $parent_node = $edition_obj->parentNode; $book_array[ Details ] = $parent_node->getAttribute( url ); $children = $parent_node->childNodes; foreach($children as $child_obj) { $node_name = $child_obj->nodeName; if ($node_name != #text ) { $content_str = $child_obj->nodeValue; $book_array[ $node_name ] = $content_str; } } continue; } else { // Give a message if availability isn t good$book_array[ ProductName ] = Not available at this time ; } } //print_r($book_array); $title = $book_array[ ProductName ]; $author = $book_array[ Authors ]; $image = $book_array[ ImageUrlSmall ]; $detail_page = $book_array[ Details ]; $price = $book_array[ OurPrice ]; // Format a nice box$box_str = <<< EONICEBOX