C# Api Sorunu
-
-
-
-
hocalar api' yi yakadım ApiData data = ApiResponse.GetResponse("http://dariakayaphoto.com/api/check/"); kontrolunu saglıyor
textbox1 ve textbox2 den gelen değerleri ApiData data = ApiResponse.GetResponse("http://dariakayaphoto.com/api/check/textbox1/textbox2 "); şekilinde sorgulamam lazım eğer "ok" gelirse giriş yapcak
nasıl yaprım sizce ?
-
1. sana dönen datanın cinsi JSON
2. sana yazılan cevapları okumuyorsun.
-
infazteam bunu yazdı
hocalar api' yi yakadım ApiData data = ApiResponse.GetResponse("http://dariakayaphoto.com/api/check/"); kontrolunu saglıyor
textbox1 ve textbox2 den gelen değerleri ApiData data = ApiResponse.GetResponse("http://dariakayaphoto.com/api/check/textbox1/textbox2 "); şekilinde sorgulamam lazım eğer "ok" gelirse giriş yapcak
nasıl yaprım sizce ?
ApiData data = ApiResponse.GetResponse("http://dariakayaphoto.com/api/check/login?nick=NICKIALDIR&pw=SIFREYIALDIR");
Seklinde bir istek yollar, gelen veriye gore kontrol ettirirsin hocam. Yukaridaki yapiyi ise php ile olsturacaksin.
-
end bunu yazdıinfazteam bunu yazdı
hocalar api' yi yakadım ApiData data = ApiResponse.GetResponse("http://dariakayaphoto.com/api/check/"); kontrolunu saglıyor
textbox1 ve textbox2 den gelen değerleri ApiData data = ApiResponse.GetResponse("http://dariakayaphoto.com/api/check/textbox1/textbox2 "); şekilinde sorgulamam lazım eğer "ok" gelirse giriş yapcak
nasıl yaprım sizce ?
ApiData data = ApiResponse.GetResponse("http://dariakayaphoto.com/api/check/login?nick=NICKIALDIR&pw=SIFREYIALDIR");
Seklinde bir istek yollar, gelen veriye gore kontrol ettirirsin hocam. Yukaridaki yapiyi ise php ile olsturacaksin.
başaramadım hocam :(
-
string adres = "http://dariakayaphoto.com/api/check/login?nick="+textbox1+"&pw="+textbox2+"";
WebResponse cevap;
WebRequest istek = HttpWebRequest.Create(adres);
cevap = istek.GetResponse();
StreamReader donnebilgiler = new StreamReader(cevap.GetResponseStream());
string gelen = donnebilgiler.ReadToEnd();
status tmp = JsonConvert.DeserializeObject<status>(gelen);
Bu yukardaki senin request fonksiyonun bir tanede status için class oluştur .
class status
{
private string _status;
private string _message;
private string _data;
public string Status { get => _status; set => _status = value; }
public string Message { get => _message; set => _message = value; }
public string Data { get => _data; set => _data = value; }
}
tabi json convert işlemini newtonsoftjson kütüphanesi ile yapıosun. daha sonra o tmpten gelicek datayı nasıl işleyeceğin sana kalmış.
öneri : kullanıcı ve şifreyi direk hiç bir criptolama işleminden geçirmeden postlamanı önermem.
-
Hocam şunu izler misin sadece 20 dakika
https://www.youtube.com/watch?v=RU3HpFlwpHo
-
sorun çözüldü. Bu şekildeymiş teşekürler.
ApiData data = ApiResponse.GetResponse("http://dariakayaphoto.com/api/check/" + textBox1.Text + "/" + textBox2.Text);
if (data.status == "OK")
{
if (data.message == "Lisans aktif")
{
MessageBox.Show("OK tmm baglan");
return;
}
}
MessageBox.Show("HATA : " + data.message);
-
infazteam bunu yazdı
sorun çözüldü. Bu şekildeymiş teşekürler.
ApiData data = ApiResponse.GetResponse("http://dariakayaphoto.com/api/check/" + textBox1.Text + "/" + textBox2.Text);
if (data.status == "OK")
{
if (data.message == "Lisans aktif")
{
MessageBox.Show("OK tmm baglan");
return;
}
}
MessageBox.Show("HATA : " + data.message);
Hocam bu tür kontrolleri boolean değerlerle gerçekleştirmen daha doğru olur bence.