Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using JSON;
- using Newtonsoft.Json;
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Net;
- namespace Spritpreisrechner
- {
- class Program
- {
- static void Main(string[] args)
- {
- preise();
- }
- private static void preise()
- {
- string json;
- var httpWebRequest = (HttpWebRequest)WebRequest.Create("https://api.e-control.at/sprit/1.0/search/gas-stations/by-address?latitude=48.150201766714105&longitude=16.319807691015892&fuelType=SUP&includeClosed=false");
- httpWebRequest.ContentType = "text/json";
- httpWebRequest.Method = "GET";
- var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
- using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
- {
- var responseText = streamReader.ReadToEnd();
- json = responseText;
- }
- var result = JsonConvert.DeserializeObject<List<Price>>(json);
- //Console.WriteLine(result.Count);
- foreach (var preis in result)
- {
- Console.WriteLine(preis.Amount);
- }
- Console.Read();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement