1. Enable dynamic server-side flight Software
Capture Ctrip's one-way, round-trip, and connecting flight data.
Software Interface:
Jar: http://download.csdn.net/detail/a600423444/3648490
Source code: http://download.csdn.net/detail/a600423444/3648536
Ii. php client request demo
<? Phperror_reporting (e_all); $ service_port = 8123; $ address = 'localhost'; $ commonprotocol = getprotobyname ("TCP"); $ socket = socket_create (af_inet, sock_stream, $ commonprotocol ); if ($ socket <0) {echo "cause of socket creation failure :". socket_strerror ($ socket ). "\ n" ;}$ result = socket_connect ($ socket, $ address, $ service_port); if ($ result <0) {echo "socket connection failure cause: ($ result) ". socket_strerror ($ result ). "\ n";} echo "connection created successfully, preparing data \ r \ n"; // One-Way request String concatenation $ in = "flight search 1.0 \ n "; $ in. = "startcty: Sha \ n"; $ in. = "endcity: BJs \ n"; $ in. = "flightway: 1 \ n"; $ in. = "Date: 2011-10-05 \ n"; // round-trip test data for the first test // $ in = "flight search 1.0 \ n"; // $ in. = "startcty: Sha \ n"; // $ in. = "endcity: BJs \ n"; // $ in. = "flightway: 2 \ n"; // $ in. = "Date: 2011-10-05 \ n"; // $ in. = "date2: 2011-10-07 \ n"; // round-trip test data for the second process // $ in = "flight search 1.0 \ n"; // $ in. = "startcty: Sha \ n"; // $ in. = "endcity: BJs \ n"; // $ in. = "flightway: 2 \ n"; // $ in. = "Date: 2011-10-05 \ n"; // $ in. = "date2: 2011-10-07 \ n"; // $ in. = "flight1: ca1516 \ n"; // $ in. = "price1: 790 \ n"; // $ in. = "subclass1: l \ n"; // the first test of the connection // $ in = "flight search 1.0 \ n"; // $ in. = "startcty: Sha \ n"; // $ in. = "endcity: BJs \ n"; // $ in. = "transitcity: Can \ n"; // $ in. = "flightway: 3 \ n"; // $ in. = "Date: 2011-10-05 \ n"; // $ in. = "date2: 2011-10-07 \ n"; // The second test of the connection procedure // $ in = "flight search 1.0 \ n"; // $ in. = "startcty: Sha \ n"; // $ in. = "endcity: BJs \ n"; // $ in. = "transitcity: Can \ n"; // $ in. = "flightway: 3 \ n"; // $ in. = "Date: 2011-10-05 \ n"; // $ in. = "date2: 2011-10-07 \ n"; // $ in. = "flight1: mu5138 \ n"; // $ in. = "price1: 1130 \ n"; // $ in. = "subclass1: Y \ n"; $ out = ''; socket_write ($ socket, $ in, strlen ($ in); echo" data transmission is complete, wait for \ n "; while ($ out = socket_read ($ socket, 4096) {echo $ out;} echo" received \ n "; socket_close ($ socket ); echo $ out;
Returned results:
Connection created successfully. Preparing data
Sending data is complete, waiting for return
7:55:00 | 10:15:00 | Sha | pek | ca | L | 570 | 7 | 7 | 5.0, | ca1858 | G
8:00:00 | 10:15:00 | Sha | pek | Mu | L | 680 | 7 | 7 | 6.0, | mu5101 | S
8:30:00 | 10:50:00 | Sha | pek | Fm | L | 1010 | 70973825 | 5 | 7 | 1, 2 | 3.6 | fm9101 | P
8:55:00 | 11:15:00 | Sha | pek | ca | M | 680 | 7 | 7 | 6.0, | ca1590 | Q
9:00:00 | 11:20:00 | Sha | pek | Mu | L | 1010 | 70973860 | 5 | 7 | 1, 2 | 3.6 | mu5103 | P
Received