【发布时间】:2011-12-09 08:33:11
【问题描述】:
我想从 phpMyAdmin 服务器获取数据。我知道的唯一功能是:
private String getPage() {
String str = "***";
try
{
HttpClient hc = new DefaultHttpClient();
HttpPost post = new HttpPost("http://mywebsite.me");
HttpResponse rp = hc.execute(post);
if(rp.getStatusLine().getStatusCode() == HttpStatus.SC_OK)
{
str = EntityUtils.toString(rp.getEntity());
}
}catch(IOException e){
e.printStackTrace();
}
return str;
}
它不起作用,因为我需要使用用户名和密码来验证自己。我认为此功能不起作用的另一个原因是它获取了页面的来源(Chrome 中的 ctrl+u)并且我需要的值不存在,它们在服务器上的一个表中。我怎么能那样做?
【问题讨论】:
标签: java android phpmyadmin fetch