I used to sync the data to the server
1. Send a TXT text using FTP and then disassemble it with PHP.
2. Using a direct link database
The quality of the scheme depends on 1. Whether the database can be directly linked (security is also a problem) 2. Link efficiency of the database. Outside links, always less fast than local links.
3. Talk about the third approach today, JAVA post data to the server
Send a POST request
String sr=httprequest.sendpost ("http://localhost:6144/Home/RequestPostString", "key=123&v=456");
/** * Request to send a POST method to the specified URL * * @param URL * Send request URL * @param param * Request parameter, request parameter should be Name1=value1& ; a form of name2=value2. * @return The response result of the remote resource represented by */public static string sendpost (string url, string param) {printwriter out = null; BufferedReader in = null; String result = "", try {url realurl = new URL (URL),//Open and URL connection URLConnection conn = Realurl.openconnection ();//set generic request genus Sexual Conn.setrequestproperty ("accept", "*/*"), Conn.setrequestproperty ("Connection", "keep-alive"); Conn.setrequestproperty ("User-agent", "mozilla/4.0" (compatible; MSIE 6.0; Windows NT 5.1; SV1);//The Send POST request must be set to the following two lines Conn.setdooutput (true), conn.setdoinput (TRUE);//get the output stream for the URLConnection object out = new PrintWriter (Conn.getoutputstream ());//Send request parameter out.print (param);//Flush output stream buffer Out.flush ();// Defines the BufferedReader input stream to read the response of the URL in = new BufferedReader (New InputStreamReader (Conn.getinputstream ())); String Line;while (line = In.readline ()) = null) {result + = line;}} catch (Exception e) {System.out.println ("send POST request exception! "+ e); E.printstacktrace ();} Use the finally block to close the output stream, input stream finally {try {if (out! = null) {Out.close ();} if (in = null) {In.close ();}} catch (IOException ex) {ex.printstacktrace ();}} return result;}
Java post data to third-party URLs