Recommended:

  • phpclasses.org
  • jsclasses.org
  • jsmag.com
  • siteapps.com
  • View our reviews on Hot Scripts
  • JS Tutorial
  • scripts.com
  • securesignup.com




Recent Comments

Powered by Disqus




Back to articles

Get book title based on ISBN

Here is a function to get book title and author based on book's ISBN number. To use this function you will have to register here: http://isbndb.com to get your API key.

After that you can use this function to ge xml data about the book:

<?php
//fucntion to get book title and author based on ISBN number
function check_isbn($isbn)
{ 
    //your API key
    $key = "12345678";
    //url to connect to
    $url = "http://isbndb.com/api/books.xml?access_key=".
            $key."&index1=isbn&value1=".$isbn; 

    // send request 
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    $curlData = curl_exec($curl);
    curl_close($curl);
    //returning retrieved xml
    return $curlData;

}

//making page to behave like xml document to show xml
header('Content-Type:text/xml; charset=UTF-8');
//calling function
$isbn_number = "0764549421";
$xml = check_isbn($isbn_number);
echo $xml;
?>

You may also be interested in:

Powered by BlogAlike.com

blog comments powered by Disqus