Package com.cn;
Import java. Io. bufferedreader;
Import java. Io. inputstream;
Import java. Io. inputstreamreader;
Import java. Io. objectoutputstream;
Import java.net. httpurlconnection;
Import java.net. url;
Import org. jsoup. jsoup;
Import org. jsoup. nodes. Document;
Import org. jsoup. Select. elements;
Public class HTTP {
/**
* @ Param ARGs
*/
Public static string url = "http: // 192.168.0.172/HS/androids/report. php? UN = 1 ";
Public static void main (string [] ARGs ){
// Todo auto-generated method stub
String URLs = "http: // 127.0.0.1/HS/androids/report. php? UN = I have been here for weeds ";
Try {
URL url = new URL (URLs );
Httpurlconnection HTTP = (httpurlconnection) URL. openconnection ();
HTTP. setdoinput (true );
HTTP. setdooutput (true );
HTTP. setusecaches (false );
HTTP. setrequestmethod ("get ");
HTTP. Connect ();
Objectoutputstream OSI = new objectoutputstream (HTTP. getoutputstream ());
String curlpost = "Un = 1 ";
OSI. Write (curlpost. getbytes ("UTF-8 "));
OSI. Flush ();
OSI. Close ();
String result = "";
Inputstream merge M = http. getinputstream ();
Bufferedreader in = new bufferedreader (New inputstreamreader (Bytes m ));
String inputline;
While (inputline = in. Readline ())! = NULL ){
Result = result. Concat (inputline );
}
System. Out. println (result );
Change (result );
In. Close ();
HTTP. Disconnect ();
} Catch (exception e ){
System. Out. println ("Err ");
}
}
Public static void change (string Str)
{
Document Dc = jsoup. parse (STR );
Elements em = Dc. Select ("body ");
Em = em. Select ("Div ");
System.out.println(em.html ());
}
}
Returned results