我向服务器请求响应为
HTML
像这样键入:
<!DOCTYPE html>
<html>
<head>
<title>info starter</title>
</head>
<body>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Ø¨Ø§Ø²Û ÙÙ
ا</title>
<style>
}
} }
body{margin: 0;direction: rtl; font-family: myFont;font-size: 16px;padding: 1em 2em;background: url('https://bazinama.vasapi.click/static/bazinama-files/images/boundry.jpg') top center;color: #fff;}.coins{float: left;font-size: 1.5em;margin-top: -0.2em;}.coin-img{width: 1.5em;margin: -0.1em 0.5em;float: left;animation: coin 1s infinite linear;-webkit-animation: coin 1s infinite linear;-moz-animation: coin 1s infinite linear;}.row{margin: 2em 0;}p{line-height: 2.4em !important;}.title{text-align: center;margin-bottom: 1.5em;}.title .bold{font-size: 1.5em;color: #ffc800;}.box{background: rgba(11, 111, 251, 0.9);padding: 1em;border-radius: 1em;-webkit-border-radius: 1em;-moz-border-radius: 1em;margin: 2em 0;}.mobile-icon{width: 70px;float: right;}
</style>
</head>
<body>
<h2 class="title">
<span class="bold"> استارترØ</span>Ø Ù¾ÙØªÙرÙ
ØÙ
Ø§ÛØª از Ø¨Ø§Ø²Û ÙØ§Û Ø§ÛØ±Ø§ÙÛ Ù Ø¨Ø§Ø²Û Ø³Ø§Ø²Û Ù
ÙÛ Ø§Ø³Øª.
</h2>
<p>Ú¯ÛÙ
Ø±ÙØ§Ø شرکت ÙØ§ ٠تÛÙ
ÙÙ¾Ø±Ø¯Ø§Ø²ÙØ¯Ø. </p>
</body>
</html>
</body>
</html>
我把我的要求改成这样:
@Headers("Accept: text/html")
@GET("pages/Bazinamamag/starter/")
Call<ResponseBody> getContactUsInfo();
像这样准备请求:
@Override
public void getContactUsInfo(@Nullable final LoadContactUsCallback callback) {
final ApiService service = ServiceGenerator.createService(ApiService.class);
service.getContactUsInfo().enqueue(new Callback<ResponseBody>() {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
try {
Log.d(TAG, "onResponse: " + response.body().string());
callback.onTasksLoaded(response.body().string());
} catch (IOException e) {
e.printStackTrace();
Log.e(TAG, "onResponse: " + e.getMessage());
}
}
@Override
public void onFailure(Call<ResponseBody> call, Throwable t) {
Log.e(TAG, "onFailure: " + t.getMessage());
callback.onDataNotAvailable();
}
});
}
但总是不能得到
HTML格式
正在响应且为的代码。
如何获取html响应?
谢谢您。