I'm getting the following exception:
Newtonsoft.Json.JsonReaderException in Newtonsoft.Json.dll ("Error reading JObject from JsonReader. Current JsonReader item is not an object: StartArray. Path '', line 1, position 1."). Exception thrown: 'Newtonsoft.Json.JsonReaderException' in Newtonsoft.Json.dll ("Error reading JObject from JsonReader. Current JsonReader item is not an object: StartArray. Path '', line 1, position 1.
Here is the code:
JObject data = JObject.Parse(verigetir(veri.getir(), "cari_ip_alma.php"));
public string verigetir(string veri, string sayfa)
{
string postData;
WebRequest request = WebRequest.Create(server + sayfa);
request.Method = "POST";
postData = veri;
byte[] byteArray = Encoding.UTF8.GetBytes(postData);
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = byteArray.Length;
Stream dataStream = request.GetRequestStream();
dataStream.Write(byteArray, 0, byteArray.Length);
dataStream.Close();
WebResponse response = request.GetResponse();
dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
return reader.ReadToEnd();
reader.Close();
dataStream.Close();
response.Close();
}
class parametreOlustur
{
public string data;
public void birlestir(string a, string b)
{
data += "&" + a + "=" + b;
}
public string getir()
{
return data;
}
}
PHP Code :
https://shrib.com/?v=md#iT73qB_Lr250Uoh8CZbk
if i'm change php codes $row= $sql->fetchAll(PDO::FETCH_ASSOC) fetchAll to Fetch , program is working but getting first data.