如何使用Volley发送印地语的GET请求?

时间:2017-07-19 03:06:32

标签: php android

image to show it is not taking rabi as url

以下是我的Android代码,用于从type=खरीफ的网络服务获取数据。当我使用Postman进行检查时,它正在运行。但是当我用android检查它时,它无效。

String GET_JSON_DATA_HTTP_URL = "http://ddagroindore.com/webservice/GetFasal.php?type=";

 public void JSON_DATA_WEB_CALL(){
    String s = getIntent().getStringExtra("RABI");

    String URL = GET_JSON_DATA_HTTP_URL+s;
    Log.d(TAG, "JSON_DATA_WEB_CALL: "+URL);

    jsonArrayRequest = new JsonArrayRequest( URL,

            new Response.Listener<JSONArray>() {
                @Override
                public void onResponse(JSONArray response) {

                    JSON_PARSE_DATA_AFTER_WEBCALL(response);
                }
            },
            new Response.ErrorListener() {
                @Override
                public void onErrorResponse(VolleyError error) {

                }
            });

    requestQueue = Volley.newRequestQueue(this);

    requestQueue.add(jsonArrayRequest);
}

Log.d

  

JSON_DATA_WEB_CALL:http://ddagroindore.com/webservice/GetFasal.php?type=खरफफ

GetFasal.php

    <?php

        require_once 'include/DB_Config.php';

// Create connection
$conn =new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE);
$conn->set_charset("utf8");

 //$conn = mysqli_connect(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_NAME) or die('Unable to Connect');


if ($conn->connect_error) {
 die("Connection failed: " . $conn->connect_error);
}
if($_SERVER['REQUEST_METHOD']=='GET'){

        $type  = $_GET['type'];
        $sql = "SELECT * FROM fasals WHERE type='".$type."'";
$result = $conn->query($sql);

if ($result->num_rows >0) {
 // output data of each row
 while($row[] = $result->fetch_assoc()) {

 $tem = $row;

 $json = json_encode($tem, JSON_UNESCAPED_UNICODE);


 }

} else {
 echo "0 results";
}
 echo $json;
$conn->close();
}
?>

0 个答案:

没有答案