954,600 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

how to access another webpage from mine?

hi :)

i'm just wondering if there is any way to access to another website using my own?

like:
i have some input data and when i put it into the form of my website, it will search it in the another website's database and show me the result.

i know the way to do it only if the URL of that website changes once i give the input

<%@ page import="java.net.*" %>
<%@ page import="java.io.*" %>

<html>
<body>
<%

if (request.getParameter("word") != null && request.getParameter("to") != null) {
	
		String TARGET_SITE = "http://www.google.co.kr/dictionary?langpair=en|";
		String result="";
		String targetWord=request.getParameter("word");
		String targetLang=request.getParameter("to");
		String between1 = "&q=";
		String between2 = "&hl=";
		String atend = "&aq=f";
		
		String data;
		URL u;
		URLConnection uc;
		
		u = new URL(TARGET_SITE+targetLang+between1+targetWord+between2+targetLang+atend);
		uc = u.openConnection(); 

		InputStream is = uc.getInputStream(); 
		BufferedReader reader = new BufferedReader(new InputStreamReader(is));
		while((data = reader.readLine()) != null){
			result += data;
		}

		String zeroSearch = "<strong>0</strong> result for";//+targetWord+" in UniProtKB";

		if(result.indexOf(zeroSearch) > -1){			//if search not found
			out.print(zeroSearch+" "+targetWord);
		}
		else{
			String searchHTMLstring = "padding:0 .25em 0 .25em; width:auto; overflow:visible";
			int startFrom = result.indexOf(searchHTMLstring);

			String getHTML = result.substring(startFrom, result.length());

			out.print(getHTML);
		}
}//end if
else{
		out.print("");	//not to appear with result
}
%>



<form method=get target=_blank>
English Word:
<input type=text name=word><input type=submit value=Search>
To: <input type=radio name=to value=ko> Korean
<input type=radio name=to value=ru> Russian 

</form>
</body>
</html>


but what if the URL still remains same even after i give the input? :?:
please someone help me :'(

gingerfish
Light Poster
47 posts since Jan 2010
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: