$folder_dir='/1';
$_SERVER['DOCUMENT_ROOT'].$folder_dir
function btce_query($method, array $req = array()) {
// API settings
$key = '0F46PFV9-QWTNNRDV-5Z90WTHX-SB8LBMYR-2N2RVFAD'; // your API-key
$secret = 'Da3edfcdba19c1a41221624848d40d9bc560bc4d89n19dbjb2e1026396c685e2'; // your Secret-key
$req['method'] = $method;
$mt = explode(' ', microtime());
$req['nonce'] = $mt[1];
// generate the POST data string
$post_data = http_build_query($req, '', '&');
$sign = hash_hmac('sha512', $post_data, $secret);
// generate the extra headers
$headers = array(
'Sign: '.$sign,
'Key: '.$key,
);
// our curl handle (initialize if required)
static $ch = null;
if (is_null($ch)) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; BTCE PHP client; '.php_uname('s').'; PHP/'.phpversion().')');
}
curl_setopt($ch, CURLOPT_URL, 'https://liqui.io/tapi/');
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
// run the query
$res = curl_exec($ch);
if ($res === false) throw new Exception('Could not get reply: '.curl_error($ch));
/*
$dec = json_decode($res, true);
if (!$dec) throw new Exception('Invalid data received, please make sure connection is working and requested API exists');
*/
$dec = json_decode($res, true);
$err = json_last_error();
if ($err !== JSON_ERROR_NONE) throw new Exception('Invalid data received, please make sure connection is working and requested API exists ');
return $dec;
}
$result = btce_query('getInfo');
//$result = btce_query('Trade', array('pair' => 'btc_usd', 'type' => 'buy', 'amount' => 1, 'rate' => 10)); //buy 1 BTC @ 10 USD
var_dump($result);
/** PHPExcel */
include ('PHPExcel/PHPExcel.php');
/** PHPExcel_Writer_Excel2007 */
include ('PHPExcel/PHPExcel/Writer/Excel2007.php');
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
//Ширина колонок по содержимому
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setAutoSize(true);
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setAutoSize(true);
//первая колонка первая ячейка
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(1,1,'Текст в ячейке');
//Сохранение в файл
$objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
$objWriter->save('output_files_folder/myexcel.xlsx');
unset($objWriter);
chown -R www-data /var/www/output_files_folder/
$site_dir='4';
$path_to_root_site_dir = $_SERVER['DOCUMENT_ROOT']."/$site_dir/";
include_once ('settings.php'); //Некорректно!
include_once ($_SERVER['DOCUMENT_ROOT']."/4/settings.php"); //Корректно!
//Иконка как бы намекает )