function callback_function($response, $info, $request) { global $objPHPExcel, $time_array, $amount_array; if ($info['http_code'] !== 200) { AngryCurl::add_debug_msg("->\t" . $request->options[CURLOPT_PROXY] . "\tFAILED\t" . $info['http_code'] . "\t" . $info['total_time'] . "\t" . $info['url']); } else { AngryCurl::add_debug_msg("->\t" . $request->options[CURLOPT_PROXY] . "\tOK\t" . $info['http_code'] . "\t" . $info['total_time'] . "\t" . $info['url']); preg_match("/Значение комиссии: (.*?)</", $response, $m); $commision = str_replace(' Руб.', '', $m[1]); $row = array_search($request->post_data['money'], $amount_array) + 2; $col = array_search($request->post_data['dd'], $time_array) + 1; $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($col, $row, $commision); set_commision_style($col, $row); } return; }
$options['program'] = $program; $options['avans'] = $avans; $options['money'] = $amount; $options['dd'] = $time; $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $options); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_URL, $url); $result = curl_exec($ch); curl_close($ch); preg_match("/Значение комиссии: (.*?)</", $result, $m); $commision = str_replace(' Руб.', '', $m[1]); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($col, $row, $commision); set_commision_style($col, $row); $col += 1; } $row += 1; } $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); $objWriter->save(str_replace('.php', '.xls', __FILE__)); function set_header_style($x, $y) { global $objPHPExcel; $cell_name = coordinates($x, $y); $objPHPExcel->getActiveSheet()->getStyle($cell_name)->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle($cell_name)->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setARGB('FF99CCFF'); $objPHPExcel->getActiveSheet()->getStyle($cell_name)->getBorders()->getBottom()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN); } function set_leftside_style($x, $y)