O iş öyle olmaz, veri çektiği yere erişmek lazım.
Konya için istedin Konya namaz vakitleri için kodlar.
VB.net olarak :
Public Class WebForm1
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim request = DirectCast(Net.WebRequest.Create("http://www.diyanet.gov.tr/PrayerTime/PrayerTimesSet"), Net.HttpWebRequest)
'burada yer alan değerleri şehre göre düzenlemek lazım
Dim data = Encoding.ASCII.GetBytes("{countryName: ""2"", stateName: ""552"", name: ""9676""}")
request.Method = "POST"
request.ContentType = "application/json; charset=UTF-8"
request.ContentLength = data.Length
request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0"
Using stream = request.GetRequestStream()
stream.Write(data, 0, data.Length)
End Using
Dim cevap = DirectCast(request.GetResponse(), Net.HttpWebResponse)
Dim cevapString = New IO.StreamReader(cevap.GetResponseStream()).ReadToEnd()
Dim jsons = Newtonsoft.Json.JsonConvert.DeserializeObject(Of VakitElemanlari)(cevapString)
Response.Write("Aksam : " & jsons.Aksam)
Response.Write("<br>")
Response.Write("Yatsı :" & jsons.Yatsi)
End Sub
End Class
Public Class VakitElemanlari
Public Property Imsak As String
Public Property Gunes As String
Public Property Ogle As String
Public Property Ikindi As String
Public Property Aksam As String
Public Property Yatsi As String
Public Property NextImsak As String
Public Property MoonSrc As String
Public Property HicriTarih As String
Public Property MiladiTarih As String
Public Property RumiTarih As String
Public Property Enlem As String
Public Property KibleAcisi As String
Public Property UlkeAdi As String
Public Property SehirAdi As String
Public Property KibleSaati As String
Public Property GunesBatis As String
Public Property GunesDogus As String
Public Property ItemId As String
End Class
c# olarak :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
dynamic request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create("http://www.diyanet.gov.tr/PrayerTime/PrayerTimesSet");
dynamic data = System.Text.Encoding.ASCII.GetBytes("{countryName: \"2\", stateName: \"552\", name: \"9676\"}");
request.Method = "POST";
request.ContentType = "application/json; charset=UTF-8";
request.ContentLength = data.Length;
request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0";
using (System.IO.Stream stream = request.GetRequestStream())
{
stream.Write(data, 0, data.Length);
}
dynamic cevap = (System.Net.HttpWebResponse)request.GetResponse();
dynamic cevapString = new System.IO.StreamReader(cevap.GetResponseStream()).ReadToEnd();
dynamic jsons = Newtonsoft.Json.JsonConvert.DeserializeObject<VakitElemanlari>(cevapString);
Response.Write("Aksam : " + jsons.Aksam);
Response.Write("<br>");
Response.Write("Yatsı :" + jsons.Yatsi);
}
}
public class VakitElemanlari
{
public string Imsak { get; set; }
public string Gunes { get; set; }
public string Ogle { get; set; }
public string Ikindi { get; set; }
public string Aksam { get; set; }
public string Yatsi { get; set; }
public string NextImsak { get; set; }
public string MoonSrc { get; set; }
public string HicriTarih { get; set; }
public string MiladiTarih { get; set; }
public string RumiTarih { get; set; }
public string Enlem { get; set; }
public string KibleAcisi { get; set; }
public string UlkeAdi { get; set; }
public string SehirAdi { get; set; }
public string KibleSaati { get; set; }
public string GunesBatis { get; set; }
public string GunesDogus { get; set; }
public string ItemId { get; set; }
}