Click here to Skip to main content
15,895,777 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to fetch(read) data from another website

i want to read data from

http://whatismyipaddress.com/ip/101.2.50.106[^]

input is ip address
using Query String like
http://whatismyipaddress.com/ip/txtIp.Text

from this page i want

General IP Information and Geolocation Information

i want it in a html format

how can i read...
help me ...
thanks
Posted

This will get the HTML content from that page but the CSS, styling and any other dynamic effects will not be downloaded. Play around with this.


HTML
<html>
<head>
<script type="text/javascript">
function loadXMLDoc()
{
var xmlhttp;
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","http://www.sehajpal.com",true);
xmlhttp.send();
}
</script>
</head>
<body>

<div id="myDiv"><h2>Result HTML goes here.</h2></div>
<button type="button"  önclick="loadXMLDoc()">Fetch HTML</button>
</body>
</html>
 
Share this answer
 
Comments
PKriyshnA 8-May-12 10:21am    
its not working
PKriyshnA 8-May-12 10:30am    
i can not get all data i mean i pass http://whatismyipaddress.com/ip/101.2.50.106
so i have to fetch General IP Information and Geolocation Information generated by http://whatismyipaddress.com/ip/101.2.50.106 link...

here i get blank data...

passed link should be load after loading linked page we have to fetch data....


By the way i will help me in future...thanks a lot for your valuable reply
If you want to download a webpage from c#, use the WebClient class:

C#
WebClient client  = new WebClient();
var content = client.DownloadString("http://whatismyipaddress.com/ip/101.2.50.106");
 //here you have the page downloaded int he the 'content' variable


The WebClient class have other methods that can help you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900