服务器未找到错误,000Webhost 域和用于数据发送的 Ion 库?

Server not found error, 000Webhost domain and Ion library for data sending?

我是向在线服务器传输数据的新手。我一直在关注它的多个教程,因为 DefaultHttpClient 在最新的 sdk 中已被弃用,所以我一直在使用第 3 方库 Ion Github Link,我正在使用 000Webhost 域作为在线服务器。

我现在正在关注这个 答案,

这是我的客户端android应用程序代码

row.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View v) {
                Toast.makeText(ab,"Long clicked",Toast.LENGTH_LONG).show();
                JsonObject jsonObject = new JsonObject();
                jsonObject.addProperty("AddressType", a.get(position).getKEY_Address_Type());
                jsonObject.addProperty("Email", a.get(position).getKEY_Place_Email());
                jsonObject.addProperty("Name", a.get(position).getKEY_Place_Name());
                jsonObject.addProperty("Number", a.get(position).getKEY_Place_Number());
                jsonObject.addProperty("Type", a.get(position).getKEY_Place_Type());
                if(a.get(position) instanceof AutoClass){
                    AutoClass ab=(AutoClass)a.get(position);
                    jsonObject.addProperty("HintAddress", ab.getAuto_KEY_Place_Hint_Address());
                    jsonObject.addProperty("PlaceLangitude", ab.getAuto_KEY_Place_Langitude());
                    jsonObject.addProperty("PlaceLatitude", ab.getAuto_KEY_Place_Latitude());


                }
                else {
                    ManualClass ab=(ManualClass)a.get(position);
                    jsonObject.addProperty("PlaceAddress", ab.getKEY_Place_Address());
                }
                Ion.with(ab).load("http://addressbook.netau.net/config.php").setJsonObjectBody(jsonObject).asJsonObject()
                        .setCallback(new FutureCallback<JsonObject>() {
                            @Override
                            public void onCompleted(Exception e, JsonObject result) {

                                if (result != null) {
                                    Boolean risultato = result.get("result").getAsString().equals("1");
                                    Log.d("Result Back: ", risultato.toString());
                                    if(risultato)
                                        Toast.makeText(ab, "Server Added Success", Toast.LENGTH_LONG).show();
                                    else
                                        Toast.makeText(ab, "Server Reached Error", Toast.LENGTH_LONG).show();
                                }
                                else
                                    Toast.makeText(ab, "No server found", Toast.LENGTH_LONG).show();

                            }
                        });
                return false;
            }
        });

我要连接的 php 文件在我的域 http://addressbook.netau.net.

的主(根)目录中

这是php代码

<?php
$json = json_decode(file_get_contents('php://input'), true);
$conn = new PDO("mysql:host=mysql7.000webhost.com;dbname=a1757422_AppData","username","password");


$addType=$json['AddressType'];
$email=$json['Email'];
$name=$json['Name'];
$number=$json['Number'];
$type=$json['Type'];

if($json['PlaceLangitude']){

    $latitudine = $json['PlaceLatitude'];
    $longitudine = $json['PlaceLangitude'];
    $hint = $json['HintAddress'];

    $sql = "INSERT INTO auto(name, number, placetype, addresstype, langitude,latitude,placehint,email)
        VALUES (:name, :number, :type, :addType, :longitudine, :latitudine, :hint,:email)";
    $query = $conn->prepare($sql);
    $query->bindParam(':name', $name, PDO::PARAM_STR);
    $query->bindParam(':number', $number, PDO::PARAM_STR);
    $query->bindParam(':placetype', $type, PDO::PARAM_STR);
    $query->bindParam(':addresstype', $addType, PDO::PARAM_STR);
    $query->bindParam(':langitude', $longitudine , PDO::PARAM_STR);
    $query->bindParam(':latitude', $latitudine , PDO::PARAM_STR);
    $query->bindParam(':placehint', $hint , PDO::PARAM_STR);
    $query->bindParam(':email', $email, PDO::PARAM_STR);

    $result = $query->execute();

    if($result)
        echo json_encode(array('result' => "1"));
    else
        echo $query->errorCode();
}
else{
$pAddress= $json['PlaceAddress'];




 $sql = "INSERT INTO manual(name, number, email, addresstype, placetype,address)
        VALUES (:name, :number, :type, :email, :addType, :type, :pAddress)";
    $query = $conn->prepare($sql);
    $query->bindParam(':name', $name, PDO::PARAM_STR);
    $query->bindParam(':number', $number, PDO::PARAM_STR);
    $query->bindParam(':email', $email, PDO::PARAM_STR);
    $query->bindParam(':addresstype', $addType, PDO::PARAM_STR);
    $query->bindParam(':placetype', $type, PDO::PARAM_STR);
    $query->bindParam(':address', $pAddress, PDO::PARAM_STR);


    $result = $query->execute();

    if($result)
        echo json_encode(array('result' => "1"));
    else
        echo $query->errorCode();
}
?>            

我想做的是将一些数据从我的应用程序发送到在线服务器,然后使用 php,将该数据存储到 table,即 mysql 数据库。我对 php 也不是很了解。 请帮忙,谢谢!!

响应不是 json 对象,因此它被视为错误,显然我认为所有错误都是 "No server found"