|
- <?php
- /*
- Author:QiuSong
- Compeny:Spiders Travel
- */
- define( "QUNAR_AGENT_ID", 234 );
- define( "QUNAR_SECRET", 'b54310e21b4747cf8d4b29b394c34b3f' );
- define( "QUNAR_OTANAME", 'zhizhu' );
- define( "QUNAR_FTP_SERVER", "www.zhizhuchuxing.com" );
- define( "QUNAR_FTP_PORT", 11000 );
- define( "QUNAR_FTP_USER", "zzcx" );
- define( "QUNAR_FTP_PSD", "20160602" );
-
- define( "QUNAR_CHECK_STOCK_URL", "http://api.zhizhuchuxing.com/api1.0/qunar_check_stock.php?source=qunar" );
- define( "QUNAR_CHECK_ORDER_URL", "http://coachapi.dev.qunar.com/api/pub/getOrders.do" );
- //define( "QUNAR_CHECK_ORDER_URL", "http://train.beta.qunar.com/api/pub/getOrders.do" );
- //define( "QUNAR_CHECK_ORDER_URL", "http://coach.trade.qunar.com/api/pub/getOrders.do" );
-
- define( "QUNAR_COMPLETE_ORDER_URL", "http://coachapi.dev.qunar.com/api/pub/tellTicketInfo.do" );
- //define( "QUNAR_CHECK_ORDER_URL", "http://train.beta.qunar.com/api/pub/tellTicketInfo.do" );
- //define( "QUNAR_CHECK_ORDER_URL", "http://coach.trade.qunar.com/api/pub/tellTicketInfo.do" );
-
- function get_qunar_auth( $param_array ) {
- if( is_array($param_array) == false ) {
- return false;
- }
- ksort($param_array);
- $new_param_array =$param_array;
-
- $url_param = array();
- foreach( $new_param_array as $param_key => $param_value ) {
- $url_param[] = "{$param_key}={$param_value}";
- }
- $url_txt = implode( "&", $url_param);
- $url_txt .= QUNAR_SECRET;
- return md5($url_txt);
- }
-
- function send_post($url, $post_data) {
- $postdata = http_build_query($post_data);
- $options = array(
- 'http' => array(
- 'method' => 'POST',
- 'header' => 'Content-type:application/x-www-form-urlencoded',
- 'content' => $postdata,
- 'timeout' => 15 * 60 // 超时时间(单位:s)
- )
- );
- $context = stream_context_create($options);
- $result = file_get_contents($url, false, $context);
- return $result;
- }
-
- function descryption_by_shif( $org_string ) {
- $new_string = '';
- for($i=0;$i<strlen($org_string);$i++){
- $strtoint = ord($org_string[$i]);
- $newint = $strtoint - 10;
- $new_string .= chr($newint);
- }
- return $new_string;
- }
-
- //上传文件到指定的ftp
- function upload_file_to_ftp( $ftp_server, $ftp_port, $ftp_user, $ftp_password, $source_file, $destination_file ) {
- $conn_id = ftp_connect($ftp_server, $ftp_port);
- $login_result = ftp_login($conn_id, $ftp_user, $ftp_password);
- if ((!$conn_id) || (!$login_result)) {
- return false;
- }
-
- $upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY);
- if (!$upload) {
- return false;
- }
- ftp_close($conn_id);
- return true;
- }
- //生成一个zip文件,并把制定的文件加到这个zip包中去
- function create_zip_file( $source_file, $zip_file ) {
- $zip = new ZipArchive();
- if ($zip->open($zip_file, ZIPARCHIVE::CREATE)!==TRUE) {
- return false;
- }
- $zip->addFile($source_file);
- $zip->close();
- return true;
- }
-
-
-
-
-
|