Get data from API using C #

I would like to get this data inside a class in C # based on the url " http://sporing.bring.no/sporing.xml?q=TESTPACKAGE-AT-PICKUPPOINT ".

Unfortunately, you cannot use "XDocument xml = XDocument.Load (" "); to retrieve the data, because the URL is not an XML file.

What C # source code do I need to retrieve the xml data based on the URL " http://sporing.bring.no/sporing.xml?q=TESTPACKAGE-AT-PICKUPPOINT "?

Thank!

-1


source to share


1 answer


XDocument xml = XDocument.Parse(new WebClient().DownloadString("http://sporing.bring.no/sporing.xml?q=TESTPACKAGE-AT-PICKUPPOINT"));

      



This will probably fix your problem.

0


source







All Articles