This endpoint will retrieve product data from an Ebay product pages (/itm/) and transform it into usable JSON.
Copy <?php
$curl = curl_init();
$data = json_encode(array(
'apiKey' => 'API_KEY',
'productId' => 'PRODUCTID',
'country_code' => 'COUNTRY_CODE',
'tld' => 'TLD',
'callback' => array(
'type' => 'webhook',
'url' => 'YYYY'
)
));
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://async.scraperapi.com/structured/ebay/product',
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' => 'API_KEY',
'productIds' => ['PRODUCTID1', 'PRODUCTID2'],
'country_code' => 'COUNTRY_CODE',
'tld' => 'TLD',
'callback' => array(
'type' => 'webhook',
'url' => 'YYYY'
)
));
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://async.scraperapi.com/structured/ebay/product',
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": "ad85f5f5-2e47-4d9b-bf6e-ed1e7e8ac53d",
"attempts": 0,
"status": "running",
"statusUrl": "https://async.scraperapi.com/jobs/ad85f5f5-2e47-4d9b-bf6e-ed1e7e8ac53d",
"productId": "315668246442",
"country_code": "us",
"tld": "com",
"supposedToRunAt": "2024-11-01T08:00:29.732Z"
}
Copy {
"id": "44a7bf0f-3dfd-46ac-9fbd-b17905cbfa60",
"attempts": 0,
"status": "running",
"statusUrl": "https://async.scraperapi.com/jobs/44a7bf0f-3dfd-46ac-9fbd-b17905cbfa60",
"productId": "315668246442",
"country_code": "us",
"tld": "com"
},
{
"id": "5af00d62-70a0-40d3-bfd6-f79fa56887ee",
"attempts": 0,
"status": "running",
"statusUrl": "https://async.scraperapi.com/jobs/5af00d62-70a0-40d3-bfd6-f79fa56887ee",
"productId": "126718182209",
"country_code": "us",
"tld": "com"
}