[Áú¹®]·Î±×ÀÎÈÄ URL ÆäÀÌÁö °¡Á®¿À±â


[ ´ÙÀ½ ±Ûµé ] [ À̾ ±Û¿Ã¸®±â(´äÇϱâ) ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]

±Û¾´ÀÌ :½Å½ÂÅà 2000³â 3¿ù 29ÀÏ 20:57:05

¾È³çÇϼ¼¿ä?
·Î±×ÀÎÀ» ÇÑ ÈÄ¿¡ ÇØ´ç URLÀÇ ÆäÀÌÁö¸¦ °¡Á® ¿Ã·Á°í ÇÕ´Ï´Ù.
·Î±×ÀÎÀº Æ˾÷À©µµ¿ì¸¦ ÅëÇؼ­ Çϴ°ű¸¿ä.
ºê¶ó¿ìÀú»ó¿¡¼­´Â ´ÙÀ½°ú °°ÀÌ ·Î±×ÀÎÇÏ¸é µÇ´Âµ¥,
http://userid:passwd@www.myurl.com/index.html


±×·±µ¥ java applicationÀ¸·Î À§¿Í °°ÀÌ ·Î±×ÀÎ ÇÑ ÈÄ¿¡
GET ¹æ½ÄÀ¸·Î ÆäÀÌÁö¸¦ °¡Á®¿À·Á°í ÇÕ´Ï´Ù.
¼Ò½ºÄÚµå·Î ±¸ÇöÇÏ´Â ¹æ¹ýÀ» ¸ð¸£°Ú½À´Ï´Ù.
´ÙÀ½Àº Á¦°¡ § ¼Ò½ºÀε¥ ÀÚ²Ù 401 ¿À·ù¸¸ ¹ß»ýÇϳ׿ä.


---------------------------------------------------
import java.net.*;
import java.io.*;


class GetPage {
public static void main(String[] args) {
try {
URL u = new URL("http://www.myhome.com/filelist.html");
URLConnection uconn = u.openConnection();
// uconn.setRequestProperty("Method", "GET");
// uconn.setRequestProperty("user-pass", "userid:passwd");
uconn.setRequestProperty("userid", "passwd");
// (userid¶û passwd´Â ½ÇÁ¦¿Í´Â ´Ù¸¨´Ï´Ù.)
uconn.connect();
InputStream in = uconn.getInputStream();
for( int i; (i=in.read()) != -1; )
System.out.write( i );
System.out.flush();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
---------------------------------------------------
¹Ì¸® °¨»çµå¸³´Ï´Ù.





´ÙÀ½ ±Ûµé:



À̾ ±Û¿Ã¸®±â(´äÇϱâ)

À̸§:
E-Mail:
Á¦¸ñ:
³»¿ë:
HTML ÅÂ±× Æ÷ÇÔ ¿©ºÎ: HTML ¹®¼­ÀÏ °æ¿ì üũ
°ü·Ã URL(¼±ÅÃ):
URL Á¦¸ñ(¼±ÅÃ):
°ü·Ã À̹ÌÁö URL:


[ ´ÙÀ½ ±Ûµé ] [ À̾ ±Û¿Ã¸®±â(´äÇϱâ) ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]