I am trying to get data from library of congress book search to get information like, title, creator, publisher etc. Below is the php and the response I get. I am stuck at [recordData] => SimpleXMLElement Object. How do I look through this to get the information i need? print_r ($yr->records->record->recordData) gives me the response “SimpleXMLElement Object()” and nothing else.
Here is the xml file
http://z3950.loc.gov:7090/voyager?version=1.1&operation=searchRetrieve&query=dinosaur&maximumRecords=1&recordSchema=dc
PHP
$entry=simplexml_load_file('http://z3950.loc.gov:7090/voyager?version=1.1&operation=searchRetrieve&query=dinosaur&maximumRecords=1&recordSchema=dc');
$namespaces = $entry->getNameSpaces(true);
$yr = $entry->children($namespaces['zs']);
print_r ($yr);
I get this response back. How do I get into the recordData part?
SimpleXMLElement Object
(
[version] => 1.1
[numberOfRecords] => 2238
[records] => SimpleXMLElement Object
(
[record] => SimpleXMLElement Object
(
[recordSchema] => info:srw/schema/1/dc-v1.1
[recordPacking] => xml
[recordData] => SimpleXMLElement Object
(
)
[recordPosition] => 1
)
)
)