javascript - In .net, how can I download this remote file -
i trying build marquee reads remote rss feed. ajax request failing due can assume cross domain restrictions. here code:
$(function () { $.ajax({ url: 'http://www.theleafchronicle.com/section/news01&template=rss_weblogs&mime=xml', datatype: 'xml', type: 'get', success: function (xml) { $(xml).each(function () { var title = $(this).find("title").text(); var des = $(this).find("description").text() + ' - '; var wrapper = "<span class='single-feed'></span>"; $(".feed-container").append($(wrapper).html(des)); }); }, error: function (err) { } }); });
this code failed, instead tried downloading xml locally , worked. concern how can download code via batch file or possibly .net executable? have tried system.net.webclient.downloadfile method , brings page instead of intended xml.
class program { static void main(string[] args) { system.net.webclient wc = new system.net.webclient(); wc.downloadfile("http://www.theleafchronicle.com/section/", "theleafchronicle.xml"); } }
you can use wc.downloadstring(url)
or wc.downloaddata(url)
depending how prefer response.
Comments
Post a Comment