You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

103 rivejä
3.0 KiB

  1. <?php
  2. /*
  3. Author:QiuSong
  4. Compeny:Spiders Travel
  5. */
  6. define( "QUNAR_AGENT_ID", 234 );
  7. define( "QUNAR_SECRET", 'b54310e21b4747cf8d4b29b394c34b3f' );
  8. define( "QUNAR_OTANAME", 'zhizhu' );
  9. define( "QUNAR_FTP_SERVER", "www.zhizhuchuxing.com" );
  10. define( "QUNAR_FTP_PORT", 11000 );
  11. define( "QUNAR_FTP_USER", "zzcx" );
  12. define( "QUNAR_FTP_PSD", "20160602" );
  13. define( "QUNAR_FTP_USER2", "qunar" );
  14. define( "QUNAR_FTP_PSD2", "a7h9aMXl" );
  15. define( "QUNAR_UPLOAD_FTP_SERVER", "59.151.31.94" );
  16. define( "QUNAR_UPLOAD_FTP_PORT", 21 );
  17. define( "QUNAR_UPLOAD_FTP_USER", "coach_zhizhu" );
  18. define( "QUNAR_UPLOAD_FTP_PSD", "zhizhu_234" );
  19. define( "QUNAR_CHECK_STOCK_URL", "http://api.zhizhuchuxing.com/api1.0/qunar_check_stock.php?source=qunar" );
  20. //define( "QUNAR_CHECK_ORDER_URL", "http://coachapi.dev.qunar.com/api/pub/getOrders.do" );
  21. //define( "QUNAR_CHECK_ORDER_URL", "http://train.beta.qunar.com/api/pub/getOrders.do" );
  22. define( "QUNAR_CHECK_ORDER_URL", "http://coach.trade.qunar.com/api/pub/getOrders.do" );
  23. //define( "QUNAR_COMPLETE_ORDER_URL", "http://coachapi.dev.qunar.com/api/pub/tellTicketInfo.do" );
  24. //define( "QUNAR_COMPLETE_ORDER_URL", "http://train.beta.qunar.com/api/pub/tellTicketInfo.do" );
  25. define( "QUNAR_COMPLETE_ORDER_URL", "http://coach.trade.qunar.com/api/pub/tellTicketInfo.do" );
  26. function get_qunar_auth( $param_array ) {
  27. if( is_array($param_array) == false ) {
  28. return false;
  29. }
  30. ksort($param_array);
  31. $new_param_array =$param_array;
  32. $url_param = array();
  33. foreach( $new_param_array as $param_key => $param_value ) {
  34. $url_param[] = "{$param_key}={$param_value}";
  35. }
  36. $url_txt = implode( "&", $url_param);
  37. $url_txt .= QUNAR_SECRET;
  38. $url_txt2 = md5($url_txt);
  39. return strtoupper($url_txt2);
  40. }
  41. function send_post($url, $post_data) {
  42. $postdata = http_build_query($post_data);
  43. $options = array(
  44. 'http' => array(
  45. 'method' => 'POST',
  46. 'header' => 'Content-type:application/x-www-form-urlencoded',
  47. 'content' => $postdata,
  48. 'timeout' => 15 * 60 // 超时时间(单位:s)
  49. )
  50. );
  51. $context = stream_context_create($options);
  52. $result = file_get_contents($url, false, $context);
  53. return $result;
  54. }
  55. function descryption_by_shif( $org_string ) {
  56. $new_string = '';
  57. for($i=0;$i<strlen($org_string);$i++){
  58. $strtoint = ord($org_string[$i]);
  59. $newint = $strtoint - 10;
  60. $new_string .= chr($newint);
  61. }
  62. return $new_string;
  63. }
  64. //上传文件到指定的ftp
  65. function upload_file_to_ftp( $ftp_server, $ftp_port, $ftp_user, $ftp_password, $source_file, $destination_file ) {
  66. $conn_id = ftp_connect($ftp_server, $ftp_port);
  67. $login_result = ftp_login($conn_id, $ftp_user, $ftp_password);
  68. if ((!$conn_id) || (!$login_result)) {
  69. return false;
  70. }
  71. $upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY);
  72. if (!$upload) {
  73. return false;
  74. }
  75. ftp_close($conn_id);
  76. return true;
  77. }
  78. //生成一个zip文件,并把制定的文件加到这个zip包中去
  79. function create_zip_file( $source_file, $zip_file ) {
  80. $zip = new ZipArchive();
  81. if ($zip->open($zip_file, ZIPARCHIVE::CREATE)!==TRUE) {
  82. return false;
  83. }
  84. $zip->addFile($source_file);
  85. $zip->close();
  86. return true;
  87. }