2017-05-21 19 views
1

私はサーバに簡単なリクエストを送信し、テキストボックスにレスポンスを表示しようとしています。私のサーバーコードは単純なエコー( "hello")です。 。 私のアプリにはリクエストを送信するボタンと2つのテキストボックスがあり、1つは応答を表示し、もう1つはエラーを表示するためのものです 私のアプリは応答テキストボックスに "hello"と表示されることを期待しています。Androidスタジオボレーの応答が悪い

<html><body><script type="text/javascript" src="/aes.js" ></script><script>function toNumbers(d){var e=[];d.replace(/(..)/g,function(d){e.push(parseInt(d,16))});return e}function toHex(){for(var d=[],d=1==arguments.length&&arguments[0].constructor==Array?arguments[0]:arguments,e="",f=0;f<d.length;f++)e+=(16>d[f]?"0":"")+d[f].toString(16);return e.toLowerCase()}var a=toNumbers("f655ba9d09a112d4968c63579db590b4"),b=toNumbers("98344c2eee86c3994890592585b49f80"),c=toNumbers("5938ce5f20b9041ea269c702ae8441d9");document.cookie="__test="+toHex(slowAES.decrypt(c,2,a,b))+"; expires=Thu, 31-Dec-37 23:55:55 GMT; path=/"; location.href="http://login.venci.ir/?i=1";</script><noscript>This site requires Javascript to work, please enable Javascript in your browser or use a browser with Javascript support</noscript></body></html> 

私の "MainActivity.java" のコードは次のとおりです:私はこれを受け

public class MainActivity extends AppCompatActivity { 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_main); 
    Button btnSend = (Button) findViewById(R.id.btnSend); 
    btnSend.setOnClickListener(new View.OnClickListener() { 
     @Override 
     public void onClick(View v) { 
      Toast.makeText(MainActivity.this, "Req Sent", Toast.LENGTH_SHORT).show(); 
      sendReq(); 
     } 
    }); 



} 

public void sendReq(){ 
    String url = "http://login.venci.ir/index.php"; 
    StringRequest request = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() { 
     @Override 
     public void onResponse(String s) { 
      TextView txtR = (TextView) findViewById(R.id.txtR); 
      txtR.setText(s); 
      Toast.makeText(MainActivity.this, "Responce", Toast.LENGTH_SHORT).show(); 
     } 
    }, new Response.ErrorListener() { 
     @Override 
     public void onErrorResponse(VolleyError volleyError) { 
      TextView txtE = (TextView) findViewById(R.id.txtE); 
      txtE.setText(volleyError.toString()); 
      Toast.makeText(MainActivity.this, "Error", Toast.LENGTH_SHORT).show(); 
     } 
    }); 
    RequestQueue queue = Volley.newRequestQueue(this); 
    queue.add(request); 
    queue.start(); 
} 

}

が私のコードや私のサーバーと間違って何ですか?

答えて

1

このエラーは私のサーバーのためです。私は私のサーバーのための無料のホスティングを使用し、このエラーはそれによって作られています。 解決策:有償ホスティングのみを使用してください!

関連する問題