http://www.amazon.co.jp/dp/4822242633
for the individual Amazon product page.
I think there are many ways to extract only the price of the product by using , but how will you achieve this?
I would appreciate it if you could let me know.
*Please use PHP as the language.
*Amazon api has a request limitation, so please use something other than amazon api.
*The price of the product is the tag part below.
<span class="a-size-medium a-color-price offer-price a-text-normal">¥2,376</span>
Thank you for your cooperation.
javascript php api
<?php
$html=file_get_contents("http://www.amazon.co.jp/dp/4822242633");
$dom = new DOMDocument();
@$dom->loadHTML ($html);
$xml = simplexml_import_dom($dom);
$ret=$xml->xpath('//span [@class="a-size-medium a-color-price offer a-text-normal"]');
echo$ret[0];
?>
This is the only way to extract it with Xpath.
This Qiita article is useful for scraping in PHP.
Introduction to scraping with native SPHP DOM - Qiita
© 2024 OneMinuteCode. All rights reserved.