This endpoint will retrieve products for a specified search term from Amazon search page and transform it into usable JSON.
Copy <? php
$curl = curl_init () ;
$data = json_encode ( array(
'apiKey' => 'APIKEY' ,
'query' => 'QUERY' ,
'country_code' => 'COUNTRY_CODE' ,
'tld' => 'TLD' ,
'callback' => array(
'type' => 'webhook' ,
'url' => 'CALLBACK'
)
) ) ;
curl_setopt_array ( $curl , array(
CURLOPT_URL => 'https://async.scraperapi.com/structured/amazon/search' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_ENCODING => '' ,
CURLOPT_MAXREDIRS => 10 ,
CURLOPT_TIMEOUT => 0 ,
CURLOPT_FOLLOWLOCATION => true ,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1 ,
CURLOPT_CUSTOMREQUEST => 'POST' ,
CURLOPT_POSTFIELDS => $data ,
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
) ,
) ) ;
$response = curl_exec ( $curl ) ;
if ( curl_errno ( $curl ) ) {
echo 'Error:' . curl_error ( $curl ) ;
} else {
echo $response;
}
curl_close ( $curl ) ;
?>
Copy <? php
$curl = curl_init () ;
$data = json_encode ( array(
'apiKey' => 'APIKEY' ,
'queries' => [ 'QUERY1' , 'QUERY2' , 'QUERY3' ] ,
'country_code' => 'COUNTRY_CODE' ,
'tld' => 'TLD' ,
'callback' => array(
'type' => 'webhook' ,
'url' => 'CALLBACK'
)
) ) ;
curl_setopt_array ( $curl , array(
CURLOPT_URL => 'http://async.scraperapi.com/structured/amazon/search' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_ENCODING => '' ,
CURLOPT_MAXREDIRS => 10 ,
CURLOPT_TIMEOUT => 0 ,
CURLOPT_FOLLOWLOCATION => true ,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1 ,
CURLOPT_CUSTOMREQUEST => 'POST' ,
CURLOPT_POSTFIELDS => $data ,
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
) ,
) ) ;
$response = curl_exec ( $curl ) ;
if ( curl_errno ( $curl ) ) {
echo 'Error:' . curl_error ( $curl ) ;
} else {
echo $response;
}
curl_close ( $curl ) ;
?>
Copy {
"id" : "f9c41146-ecd3-415c-ae0a-461de670e2e8" ,
"status" : "running" ,
"statusUrl" : "http://async.scraperapi.com/structured/amazon/search/f9c41146-ecd3-415c-ae0a-461de670e2e8" ,
"query" : "ball"
}
Copy [
[
{
"id" : "5b0c838a-d0eb-46c3-ad9a-e82e398d56a5" ,
"status" : "running" ,
"statusUrl" : "http://async.scraperapi.com/structured/amazon/search/5b0c838a-d0eb-46c3-ad9a-e82e398d56a5" ,
"query" : "ball"
} ,
{
"id" : "df83b9e1-be25-40de-8702-4e934f057867" ,
"status" : "running" ,
"statusUrl" : "http://async.scraperapi.com/structured/amazon/search/df83b9e1-be25-40de-8702-4e934f057867" ,
"query" : "motorbike"
}
]