-
-
Notifications
You must be signed in to change notification settings - Fork 10
Product
Jakiboy edited this page Jan 29, 2025
·
1 revision
This document guide you on how to utilize the Apaapi Product (Scraper).
To use the Apaapi product, it needs to be imported into your project and initialized (No credentials required).
use Apaapi\includes\Product;
$product = new Product(keyword: '_KEYWORD_', local: '_LOCALE_', tag: '_TAG_');The get() method is designed to retrieve only a single product.
- Accept:
StringASIN, ISBN
$product = new Product(keyword: 'B09G8XNW16');
$data = $product->get();To search for multiple products, use the search() method.
- Accept:
StringKeyword, ASIN, ISBN - Include:
Count
$product = new Product(keyword: 'Sony Xperia 1 VI');
$data = $product->search(count: 5);The setImage() method allows customization of image size and padding.
-
size: [ 100 | 200 | 300 | 400 | 500 | full ]. (string) -
padding: [ true | false ]. (bool)
$data = $product->setImage(size:'200', padding:false)->get();By default, the Apaapi product retrieves the rating (customer reviews).
To disable it, use the noRating() method just before getting product.
$data = $product->noRating()->get();This class inherits from the Apaapi scraper and uses the HTML DOM with specific selectors to get data.
Use setBaseUrl() method to override the base URL.
$product->setBaseUrl(); // Single data
$product->setSearchUrl(); // Multiple dataUse setSelectors() method to override the selectors array.
$product->setSelectors();