Java???HTTPЭ???????
???????????? ???????[ 2013/3/1 19:43:38 ] ????????
????web?????????????????????HTTPЭ?????????????????????????СС??????????????????HTTPЭ?顣????????????????????Apache??????????????Apache?????????80????
import java.io.*;
import java.net.*;
public class HttpRequest
{
public static void main(String []args)throws Exception{
//???????????
Socket socket = new Socket("127.0.0.1"??80);
OutputStreamWriter out = new OutputStreamWriter(socket.getOutputStream());
//HTTP????????????????HTTP???????? httpЭ?????????????????
StringBuffer sb = new StringBuffer();
sb.append("GET /mypage/button.html HTTP/1.1
");
sb.append("Host:localhost
");
sb.append("Accept-Language:zh-cn
");
//sb.append("Connection:Keep-Alive
");
//?????????
sb.append("
");
//???????????????????
out.write(sb.toString());
out.flush();
BufferedReader buf = new BufferedReader(
new InputStreamReader(socket.getInputStream()));
String str="";
//??????????????????
while((str=buf.readLine())!="
" && str!=null){
System.out.println(str);
}
buf.close();
socket.close();
}
}
????????????????html?????????????????????????????????????????????????????????????????????????????????????????????Ч????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11