search
HomeBackend DevelopmentPHP Tutorialphp根据isbn书号查询amazon网站上的图书信息的示例_php实例

插件说明:
插件根据提供的10位ISBN书号,在Amazon网站上查找该图书的详细信息。
如果找到结果,则返回一个两元素的数组,其中第一个元素是书的标题,而第二个元素是该书封面缩写图的URL地址。
它需要以下参数:$ISBN 10位ISBN书号

复制代码 代码如下:

$isbn   = '007149216X';
$result = PIPHP_GetBookFromISBN($isbn);
if (!$result) echo "Could not find title for ISBN '$isbn'.";
else echo "php根据isbn书号查询amazon网站上的图书信息的示例_php实例$result[0]";

function PIPHP_GetBookFromISBN($isbn)
{
   // Plug-in 93: Get Book From ISBN
   //
   // This plug-in looks up an ISBN-10 at Amazon.com and then
   // returns the matching book title and a thumbnail image
   // of the front cover. It requires this argument:
   //
   //    $isbn: The ISBN to look up
   //
   // Updated from the function in the book to take into
   // account changes to the Amazon HTML.

   $find = '   $img  = 'http://ecx.images-amazon.com/images/I';

   $page = @file_get_contents($url);
   if (!strlen($page)) return array(FALSE);

   $ptr1 = strpos($page, $find) + strlen($find);
   if (!$ptr1) return array(FALSE);

   $ptr2  = strpos($page, '" />', $ptr1);
   $title = substr($page, $ptr1, $ptr2 - $ptr1);

   $find = $img;
   $ptr1  = strpos($page, $find) + strlen($find);
   $ptr2  = strpos($page, '"', $ptr1);
   $image = substr($page, $ptr1, $ptr2 - $ptr1);

   return array($title, $img . $image);
}

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Amazon Asin是什么Amazon Asin是什么Nov 25, 2022 pm 02:54 PM

Amazon Asin是指亚马逊标准识别号,是亚马逊商品一个特殊的编码标识,是亚马逊用来标识其市场上所有产品的唯一编号。ASIN是亚马逊搜索功能的重要组成部分,这意味着无论客户是按类别搜索还是按产品名称搜索,都可以返回他们正在寻找的确切产品。

了解 Amazon ElastiCache 缓存技术了解 Amazon ElastiCache 缓存技术Jun 20, 2023 pm 03:37 PM

随着互联网技术的不断发展,对于网站应用程序的性能和稳定性需求也越来越高。在处理大型数据、低延迟和高并发方面,传统的后端数据库也显得力不从心。为了提高站点性能,现在很多网站开始采用缓存技术,而AmazonElastiCache就是一种非常流行的缓存解决方案。一、什么是AmazonElastiCache?AmazonElastiCache是一种分布

Xiaomi 14T series launch promo reveals mouth-watering free gifts including a chargerXiaomi 14T series launch promo reveals mouth-watering free gifts including a chargerSep 25, 2024 pm 09:18 PM

The Xiaomi 14T series will be getting announced tomorrow, September 26, and there have been not a few leaks about the device including a report that the phones will not ship with a charger in the box. However, a new accidental leak by a partner retai

Deal | Samsung 32-inch 240 Hz 4K Odyssey Neo G8 gaming monitor gets massive 43% discount in Amazon dealDeal | Samsung 32-inch 240 Hz 4K Odyssey Neo G8 gaming monitor gets massive 43% discount in Amazon dealAug 07, 2024 pm 08:52 PM

Samsung's Odyssey gaming monitor line-up features some of the best gaming monitors money can buy, often delivering on top-tier features and specifications along with their flagship pricing. The Odyssey Neo G8 sits at the higher end of Samsung's Odyss

Fire Toolbox 36 arrives to help even more Amazon Fire tablet owners break free of chainsFire Toolbox 36 arrives to help even more Amazon Fire tablet owners break free of chainsAug 16, 2024 am 06:42 AM

Amazon Fire tablets often come with a plethora of annoying restrictions, but XDA Developers forum member Datastream33 has created an all-in-one solution that can help users get around those. The tool is called Fire Toolbox, and is available for Windo

Deal | 34-inch Samsung Odyssey OLED G8 ultrawide gaming monitor drops to lowest price ever in 33% Amazon dealDeal | 34-inch Samsung Odyssey OLED G8 ultrawide gaming monitor drops to lowest price ever in 33% Amazon dealAug 08, 2024 pm 01:13 PM

Samsung is currently running its Gaming Week sale event, discounting many of its top-notch gaming monitors from the Odyssey series. One such monitor, the Samsung Odyssey G85SB OLED (model LS34BG850SNXZA), is heavily discounted for the duration of the

Deal | Grab the 77-inch Samsung S90C OLED TV for its lowest price ever on AmazonDeal | Grab the 77-inch Samsung S90C OLED TV for its lowest price ever on AmazonJun 26, 2024 pm 12:50 PM

Amazon is currently offering the 77-inch Samsung S90C OLED for just $1,899 including free shipping. According to Camel's price tracker, this is the lowest price ever listed by the American e-commerce behemoth. This sale provides a substantial 44% dis

Deal | Amazon bundles free $250 gift card with Galaxy S24 series phonesDeal | Amazon bundles free $250 gift card with Galaxy S24 series phonesJun 30, 2024 pm 07:25 PM

It might be a good time to purchase a phone from the Samsung Galaxy S24 series, as Amazon is bundling every purchase with a free $250 gift card. This offer applies to all the phones within the lineup, and it’s even available for all the storage varia

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use