如何使用java,c#或任何其他网络语言获取Google,维基百科或其他任何网页的来源。另外,我如何使用ajax从互联网上加载谷歌或任何其他网站。我试过了:
function ajaxFunction(){
var ajaxRequest; // The variable that makes Ajax possible!
try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
// Create a function that will receive data
// sent from the server and will update
// div section in the same page.
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
var ajaxDisplay = document.getElementById('23');
ajaxDisplay.innerHTML = ajaxRequest.responseText;
}
}
// Now get the value from user and pass it to
// server script.
ajaxRequest.open("POST", "https://www.google.com/search", true);
ajaxRequest.send(null);
}
答案 0 :(得分:-1)
您可以使用HttpRequest和HttpResponse,如果您需要代码来获取给定网址的网页内容,请告诉我