NYCPHP Meetup

NYPHP.org

[nycphp-talk] Reading Dublin Core Nodes from Google Books XML

Randal Rust randalrust at gmail.com
Fri Sep 25 14:06:02 EDT 2009


I am having a terrible time trying to read Dublin Core nodes from a
Google Books XML file. You can see the basic structure here:

http://code.google.com/apis/books/docs/gdata/developers_guide_protocol.html#SearchingForBooks

Here is the code that I am working with:

$address = "http://books.google.com/books/feeds/volumes?q=$q&as-isbn=$isbn";
$page = file_get_contents($address);
//
$xml = new SimpleXMLElement($page);
$item=$xml->entry[0];
$dc=$item->children("http://purl.org/dc/elements/1.1/");
echo $dc->creator;

The XML is read just fine, but when I get to the DC elements, I get
nothing. I am stumped.

-- 
Randal Rust
R.Squared Communications
www.r2communications.com
614-370-0036



More information about the talk mailing list