S.a http://www.diyanet.gov.tr/tr/namazvakitleri sayfasından konya ili için namaz vakitlerini çekmem gerekiyor ancak burdan default olarak sayfayı çektiğimde ankara seçili geliyor.
Diyanetin sayfasından konya ilini nasıl seçtirip vakitleri çekebilirim?
Asp.net Diyanet namaz vakitleri çekme
7
●2.915
- 08-09-2016, 22:34:56Üyeliği durdurulduO 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; } } - 09-09-2016, 22:43:55@CodeBoss Hocam beni gerçekten şaşırttınız ben böle kodları yazıp konuya cevap verileceğini hiç düşünmüyordum görünce şaşırdım. Çok teşekkür ederim emeğiniz için Allah razı olsun

C# kodlarını aldığımda stream kodunda hata veriyor herhangi bir sınıfı ekleyin şeklinde uyarıda vermiyor
Hata mesajı:
The name 'stream' does not exist in the current context
Resim - 11-09-2016, 00:29:00ErrorCodeBoss adlı üyeden alıntı: mesajı görüntüle
using (Stream = request.GetRequestStream())
bu kısımda verilen hata:
'System.IO.Stream' is a 'type' but is used like a 'variable' - 11-09-2016, 18:56:53Üyeliği durdurulduo kadarcık hatayı düzeltirsin demiştim fakat hiç bilgin yokmuş,imas adlı üyeden alıntı: mesajı görüntüle
c# kodlarını tekrar düzenledim, sorun yok. - 12-09-2016, 23:26:02Yadımın için teşekkürler hocam. Uzun bir aradan sonra tekrardan işe koyulunca eksikliklerimiz oluyor haklısınız. Ama hiç bilgim olmadığı da doğru değildir. iyi çalışmalarCodeBoss adlı üyeden alıntı: mesajı görüntüle

--R10.NET; Flood Engellendi -->-> Yeni yazılan mesaj 23:26:02 -->-> Daha önceki mesaj 23:20:54 --
Hakkınızı helal edin hayırlı bayramlar
