JAVA ÅÀÍøÒ³ÓÃ ÀýÈç:http://www.126.com
/*
Function name: myGetHttpFile2
Description: ÅÀÍøÒ³ÓÃ
Input: URL ÀýÈç:http://www.126.com
Output: ×Ö·û´®,ÍøÒ³µÄHTML
*/
public String myGetHttpFile2(String url){
String authentication=null;
ArrayList al=new ArrayList();
String PageURL = url;
PageURL = url ;
ArrayList urlCollection=new ArrayList();
Hashtable ht=new Hashtable();
//´úÀí£¬Èç¹ûÒª´©¹ý´úÀí½«ÏÂÃæ×¢ÊÍÈ¡Ïû
//ht=System.getProperties();
//authentication = "Basic " + new sun.misc.BASE64Encoder().encode("´úÀíµÄÓû§:´úÀíµÄÃÜÂë".getBytes());
//ht.put("proxySet", "true");
//ht.put("proxyHost", "172.16.20.2");
//ht.put("proxyPort", "80");
String urlSource=PageURL;
StringBuffer htmlBuffer=new StringBuffer();
String returnStr=null;
int codeStart=0;
int codeEnd=0;
int linkCount=0;
String getURL=null;
String realURL=null;
String urlText=null;
int from=0;
int lenURL=0;
int firstLink=0;
int endLink=0;
boolean isNewsLink=false;
try
{
URL su = new URL (urlSource);
URLConnection conn = su.openConnection();
//conn.setRequestProperty("Proxy-Authorization", authentication);
InputStream imageSource=new URL(urlSource).openStream();
int ch;
while((ch=imageSource.read())>-1)
{
htmlBuffer.append((char)ch);
}
imageSource.close();
returnStr= new String(htmlBuffer);
returnStr=new String(returnStr.getBytes("ISO8859_1"),"GBK");
}
catch(Exception e)
{
}
if(returnStr!=null){
return returnStr ;
}else{
return "empty" ;
}
}
Ïà¹ØÎĵµ£º
´«ÖDz¥¿ÍJAVAÅàѵOAÏîÄ¿2010-5-12
½ñÌì»»Á˸öнÌÊÒ£¬ÖÕÓÚ½áÊøÁËÃÆÈÈµÄ¿ÕÆøÁË¡£ÒÔǰ½ÌÊÒ¿Õµ÷´ó´óµÄÓÐÎÊÌ⣬ÏÖÔÚºÃÁË£¬¿ÉÒÔÒ»Ïí¿Õµ÷µÄÁ¹Ë¬£¬Ö»²»ÊÇΨһÃÀÖв»×ãµÄÊÇ£¬¾ÓÈ»ÓõIJ»ÊǸñÁ¦¿Õµ÷¡£ÔÚ¸ñÁ¦¿Õµ÷´ôÁËËÄÄ꣬ËäÈ»ÔÚÄǶùûÓз¢»Ó³öÎÒ¸üºÃµÄˮƽ£¬µ«ÊÇÈ˱Ͼ¹ÊÇÓиÐÇéµÄ£¬ÎÒÒ²ºÜ°®ÄǸö¸ñÁ¦£¬´ó¹«Ë¾£¬´óÆøÆÇ£¬ÌرðÊÇ£¬ÎÒà ......
1¡¢Oracle8/8i/9iÊý¾Ý¿â£¨thinģʽ£©
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
String url="jdbc:oracle:thin:@localhost:1521:orcl"; //orclΪÊý¾Ý¿âµÄSID
String user="test";
String password="test";
Connection conn= DriverManager.getConnection(url,user,password);
2¡¢DB ......