Skip to content

Product

Jakiboy edited this page Jan 29, 2025 · 1 revision

Apaapi Product Documentation

This document guide you on how to utilize the Apaapi Product (Scraper).

⚡ Initialization:

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_');

⚡ Get:

The get() method is designed to retrieve only a single product.

  • Accept: String ASIN, ISBN
$product = new Product(keyword: 'B09G8XNW16');
$data = $product->get();

⚡ Search:

To search for multiple products, use the search() method.

  • Accept: String Keyword, ASIN, ISBN
  • Include: Count
$product = new Product(keyword: 'Sony Xperia 1 VI');
$data = $product->search(count: 5);

⚡ Customize:

Image

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();

Rating

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();

⚡ Scraper:

This class inherits from the Apaapi scraper and uses the HTML DOM with specific selectors to get data.

Override base URL

Use setBaseUrl() method to override the base URL.

$product->setBaseUrl(); // Single data
$product->setSearchUrl(); // Multiple data

Override selectors

Use setSelectors() method to override the selectors array.

$product->setSelectors();

Clone this wiki locally