{
"headline": "SABA VOL.3",
"teaserText": " It is a true classic: the decoration fabric SABA. The rustling, elegant taffeta is a textile dream for any interior scheme and fascinates with a spectacular colour palette of 253 options. The plain decoration fabric suits almost every furnishing style and enchants with its stylish charm.",
"link": "https://www.jab.de/ru/ru/Collection/Erato/SABA-VOL-3/p/1-6206-369",
"linkImg": "https://assets.jab.de/email/fabrics/emotion/1-62/1-6206-369-emotion-ratio1.jpg",
"autocompleteImg": "https://assets.jab.de/preview/fabrics/emotion/1-62/1-6206-369-emotion-ratio1.jpg",
"inWishlist": false,
"productCode": "1-6206-369",
"rangeOfUse": "Портьерные ткани",
"id": "1-6206-369",
"colorCodes": [
"070",
"020"
],
"productGroup": "ST",
"inspireImageUrl": null,
"emotionImageUrl": "https://assets.jab.de/email/fabrics/emotion/1-62/1-6206-369-emotion-ratio1.jpg",
"brandName": "JAB ANSTOETZ FABRICS",
"configuratorCode": null,
"discontinuationStatus": null,
"brandCode": "JA",
"storeLocatorServices": "999901",
"productDetails": null,
"price": "",
"unit": "",
"available": true
}
$url = "https://www.jab.de/ru/ru/productsearch";
$cookie = "cookie.txt";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
if (curl_errno($ch)) die(curl_error($ch));
phpQuery::newDocument($response);
$token = pq("meta[name=_csrf]")->attr('content');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
curl_setopt($ch, CURLOPT_POST, true);
$params = array(
'Content-Type: application/json; charset=UTF-8',
'pageSize' => 30,
'resultsNew' => 30,
'searchTerm' => 30,
'resultsDisplayed' => 30,
'sortCode' => "recommendation",
'CSRFToken' => $token,
'Accept' => 'application/json, text/javascript, */*; q=0.01',
'Accept-Encoding' => 'gzip, deflate, br',
'Accept-Language' => 'ru-RU,ru;q=0.9,en;q=0.8,en-GB;q=0.7,en-AU;q=0.6,en-US;q=0.5',
'Cache-Control' => 'no-cache',
'Connection' => 'keep-alive',
'Content-Length' => '7658',
'Host' => 'www.jab.de',
'Origin' => 'https://www.jab.de',
'Pragma' => 'no-cache',
);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
$html = curl_exec($ch);
if (curl_errno($ch)) print curl_error($ch);
var_dump($html);
curl_close($ch);
$url = "https://www.jab.de/ru/ru/productsearch";
$cookie = $_SERVER['DOCUMENT_ROOT'] . '/' . "cookie.txt";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_COOKIESESSION, false);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
if (curl_errno($ch))
{
die(curl_error($ch));
}
$token = '';
if (preg_match('~<meta name="_csrf" content="(.+?)"/>~ius', $response, $m))
{
$token = $m[1];
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
$headers = [
"csrftoken: $token",
"content-type: application/json",
];
$post = '{"searchTerm":"","resultsNew":"0","pageSize":30,"resultsDisplayed":0,"sortCode":"recommendation","facet":{"colors":{"name":"\'\'","facetsValues":[]}}}';
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
echo('<xmp>');
$html = curl_exec($ch);
$info = curl_getinfo($ch);
var_dump($info);
if (curl_errno($ch))
{
print curl_error($ch);
}
var_dump($html);
curl_close($ch);