<?include($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");
<?
$server="https://eway-test.elevel.ru/";
$contract_id=intval(76);
$Key="57fe6dabd92f9a8245763ef5d076dc30fd30b317";
$user_id=intval(3787);
//статичные параметры
$time=time();
$Commandkey=$Key.$contract_id.$time;
$hash=sha1($Commandkey);
$PRODUCT=$server."api/v2/products/select/";//Получение списка товаров
print("start request \n");
if( $curl = curl_init() ) {
$params = array(
'time'=>$time,
'contract_id'=>$contract_id,
'user_id'=>$user_id,
'hash'=>$hash
);
$options = array(
CURLOPT_URL => $PRODUCT,
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => $params,
CURLOPT_RETURNTRANSFER => true, // return web page
CURLOPT_HEADER => false, // don't return headers
CURLOPT_FOLLOWLOCATION => true, // follow redirects
CURLOPT_ENCODING => "", // handle all encodings
CURLOPT_USERAGENT => "api2", // who am i
CURLOPT_AUTOREFERER => true, // set referer on redirect
CURLOPT_CONNECTTIMEOUT => $timeout, // timeout on connect
CURLOPT_TIMEOUT => $timeout, // timeout on response
CURLOPT_MAXREDIRS => 10, // stop after 10 redirects
CURLOPT_SSL_VERIFYPEER => false, // Disabled SSL Cert checks
);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt_array( $curl, $options );
$out = curl_exec($curl);
error_log($host);
error_log('len: '.strlen($out));
file_put_contents(__DIR__.'/result.json', $out);
curl_close($curl);
}
?>