This endpoint will retrieve reviews for a specified product from a Walmart reviews page and transform it into usable JSON.
Copy <? php
$curl = curl_init () ;
$data = json_encode ( array(
'apiKey' => 'APIKEY' ,
'productId' => 'PRODUCTID' ,
'tld' => 'TLD' ,
'page' => 'PAGE' ,
'sort' => 'SORT,
));
curl_setopt_array($curl, array(
CURLOPT_URL => ' https: //async.scraperapi.com/structured/walmart/review',
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' ,
'productIds' => [ 'PRODUCTID1' , 'PRODUCTID2' ] ,
'tld' => 'TLD' ,
'page' => 'PAGE' ,
'sort' => 'SORT,
));
curl_setopt_array($curl, array(
CURLOPT_URL => ' https: //async.scraperapi.com/structured/walmart/review',
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" : "aaaff531-cf95-4d8c-a0bc-0b3422c89d6b" ,
"attempts" : 0,
"status" : "running" ,
"statusUrl" : "https://async.scraperapi.com/jobs/aaaff531-cf95-4d8c-a0bc-0b3422c89d6b" ,
"productId" : "5253396052" ,
"page" : "3" ,
"supposedToRunAt" : "2024-07-01T19:49:21.577Z"
}
For multiple query requests
Copy [
{
"id" : "182104d3-0a6b-47df-8ca4-06da43c5dae0" ,
"attempts" : 0,
"status" : "running" ,
"statusUrl" : "https://async.scraperapi.com/jobs/182104d3-0a6b-47df-8ca4-06da4335dae0" ,
"productId" : "5253396052" ,
"page" : "3"
},
{
"id" : "477e21c1-5d12-4c88-a347-1997e64b9436" ,
"attempts" : 0,
"status" : "running" ,
"statusUrl" : "https://async.scraperapi.com/jobs/477e21c1-5d12-4c88-a347-1997e23b9436" ,
"productId" : "41FV2JGSJPXI" ,
"page" : "3"
}
]