Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fetch data from URL in ASP.NET

i am new to asp.net,

ı want to get data from url on asp.net. & need data to be in store into string.

if suppose this is my URL thn i want to fetch this URL Data in string,

http://www.islamicfinder.org/prayer_service.php?country=bahrain&city=manama&state=02&zipcode=&latitude=26.2361&longitude=50.5831&timezone=3.00&HanfiShafi=1&pmethod=4&fajrTwilight1=&fajrTwilight2=&ishaTwilight=0&ishaInterval=0&dhuhrInterval=1&maghribInterval=1&dayLight=0&simpleFormat=xml
like image 380
Krunal Avatar asked May 15 '26 00:05

Krunal


1 Answers

Try this

string url = "http://www.islamicfinder.org/prayer_service.php?country=bahrain&city=manama&state=02&zipcode=&latitude=26.2361&longitude=50.5831&timezone=3.00&HanfiShafi=1&pmethod=4&fajrTwilight1=&fajrTwilight2=&ishaTwilight=0&ishaInterval=0&dhuhrInterval=1&maghribInterval=1&dayLight=0&simpleFormat=xml";
            var webClient = new WebClient();
            string data = webClient.DownloadString(url);
like image 149
scartag Avatar answered May 19 '26 02:05

scartag



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!