note 78678 added to ref.xml
| From: | demonpants at gmail dot com | Date: | Tue, 23 Oct 2007 03:59:04 +0000 |
| Subject: | note 78678 added to ref.xml | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-131652@lists.php.net to get a copy of this message | ||
I wanted to access the ISBN database, and was previously parsing the HTML string generated from
their main page, that is until I discovered they have an API that returns XML.
So, if anyone wants to get some information from the ISBN database, all you need to do is the
following.
<?php
//Search the ISBN database for the book.
$url = "http://www.isbndb.com/api/books.xml?
access_key=KEY&index1=isbn&value1=$_GET[ISBN]";
$p = xml_parser_create();
xml_parse_into_struct($p,file_get_contents($url),$results,$index);
xml_parser_free($p);
$title = $results[$index[TITLELONG][0]][value];
$author = $results[$index[AUTHORSTEXT][0]][value];
$publisher = $results[$index[PUBLISHERTEXT][0]][value];
?>
You will need to get an access key from isbndb.com, but it takes two seconds and is free. When you
get it, replace KEY in the URL with your own key. Also, my code above will search for the book that
fits the ISBN number stored in the GET variable ISBN - you can search by other parameters and return
more than one result, but my example is for a simple ISBN search.
----
Server IP: 209.41.74.194
Probable Submitter: 206.208.133.75
----
Manual Page -- http://www.php.net/manual/en/ref.xml.php
Edit -- https://master.php.net/note/edit/78678
Del: integrated -- https://master.php.net/note/delete/78678/integrated
Del: useless -- https://master.php.net/note/delete/78678/useless
Del: bad code -- https://master.php.net/note/delete/78678/bad+code
Del: spam -- https://master.php.net/note/delete/78678/spam
Del: non-english -- https://master.php.net/note/delete/78678/non-english
Del: in docs -- https://master.php.net/note/delete/78678/in+docs
Del: other reasons-- https://master.php.net/note/delete/78678
Reject -- https://master.php.net/note/reject/78678
Search -- https://master.php.net/manage/user-notes.php