ini_set('memory_limit','2016M');
$server="https://eway.elevel.ru/";
$contract_id=intval(7779);
$Key="3668edb8bd8bc99ed64";
$user_id=intval(4855);
//статичные параметры
$time=time();
$Commandkey=$Key.$contract_id.$time;
$hash=sha1($Commandkey);
$PRODUCT=$server."api/v2/stocks/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__.'/result1.json', $out);
curl_close($curl);
}