Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'vendor/autoload.php';
- use ApaiIO\Configuration\GenericConfiguration;
- use ApaiIO\Operations\Lookup;
- use ApaiIO\ApaiIO;
- $asin = "ASIN";
- $conf = new GenericConfiguration();
- try {
- $conf
- ->setCountry("co.jp")
- ->setAccessKey(AWS_API_KEY)
- ->setSecretKey(AWS_API_SECRET_KEY)
- ->setAssociateTag(AWS_ASSOCIATE_TAG);
- $apaiIO = new ApaiIO($conf);
- $lookup = new Lookup();
- $lookup->setResponseGroup(array('OfferSummary'));
- $lookup->setItemId($asin);
- $formattedResponse = $apaiIO->runOperation($lookup);
- $xml = simplexml_load_string($formattedResponse);
- if (isset($xml->Items->Item->OfferSummary->LowestNewPrice->Amount))
- {
- echo "<p>{$xml->Items->Item->OfferSummary->LowestNewPrice->Amount}</p>";
- } else
- {
- echo "<p>新品の最安値がありませんでした。</p>";
- }
- } catch (\Exception $e) {
- //echo $e->getMessage();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement