Làm thế nào để gửi và nhận chuỗi dữ liệu đơn giản trên Android lên PHP Server?

Chào mọi người,
Mình đang làm 1 ứng dụng gửi text từ Android > Server PHP và nhận lại text khi PHP echo ra 1 đoạn text mới về android.

Nhưng đang bị lỗi, không lấy được dữ liệu trả về.

Đoạn code để mình thực hiện điều đó trên PHP Server:

$text = $_POST["text1"];
if($text != null){
    echo "Contact1-----".$text."-----10h49 25/03/2016 at New York city";
} else{
    echo "";
}                      

Lúc trước mình có 1 file dulieu.txt trên server rồi ghi tất cả dữ liệu lên nó, nhưng hiện tại mình muốn nó trả trực tiếp qua lệnh echo về máy android luôn, không cần phải lưu file.

Đoạn code mình làm điều đó là như thế này.

final String scripturlstring = "http://www.anyexample.com/main.php";
AddContactActivity contact;
public void sendToServer(final String text){
    contact = new AddContactActivity();
    new Thread(new Runnable() {
        @Override
        public void run() {
            try {
                String textparam = "text1=" + URLEncoder.encode(text, "UTF-8");
                URL scripturl = new URL(scripturlstring);
                HttpURLConnection connection = (HttpURLConnection) scripturl.openConnection();
                connection.setDoOutput(true);
                connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
                connection.setFixedLengthStreamingMode(textparam.getBytes().length);
                contentWriter.write(textparam);
                contentWriter.flush();
                contentWriter.close();
                InputStream answerInputStream = connection.getInputStream();
                final String answer = getTextFromInputStream(answerInputStream); 
                if(answer!="") {
                    String[] contactInfo = answer.split("-----");
 
                    contact.insertContact(contactInfo[0], contactInfo[1], contactInfo[2], "", "");
                }
                answerInputStream.close();
                connection.disconnect();
            } catch (MalformedURLException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }).start();
 }
 

public String getTextFromInputStream(InputStream is) {
    BufferedReader reader = new BufferedReader(new InputStreamReader(is));
    StringBuilder stringBuilder = new StringBuilder();
    String currentLine;
    try {
        while ((currentLine = reader.readLine()) != null) {
            stringBuilder.append(currentLine);
            stringBuilder.append("\n");
        }
    } catch (IOException e) {
        e.printStackTrace();
    } 
    return stringBuilder.toString().trim();
}

Mình không hiểu tại sao biến answer trả về giá trị null.
Mình mong muốn nó nên trả về dữ liệu dạng như thế này:
Contact1 $text 10h49 25/03/2016 at New York city

83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?