我试过这个
private static String readUrl(String urlString) throws Exception {
BufferedReader reader = null;
try {
URL url = new URL(urlString);
reader = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuffer buffer = new StringBuffer();
int read;
char[] chars = new char[1024];
while ((read = reader.read(chars)) != -1)
buffer.append(chars, 0, read);
return buffer.toString();
} finally {
if (reader != null)
reader.close();
}
}
但它返回了
<script>
document.cookie = 'BXID=AAAAAAUo78YKTFtc33JkgZ25mtq287qQum8hFjskkvwbnF0MBw==; path=/; domain=biletix.com';
location.reload(true);
</script><noscript>Couldnot find javascript support. please enable it</noscript>
我想从http://www.biletix.com/search/TURKIYE/en#!subcat_interval:12/12/15TO19/12/15
获取对象从这里开始,我可以得到我想要的东西,但这是创建这个URL
以及如何创建它的唯一方法吗?
我在Eclipse
中使用此功能,但我将迁移到Android.
我找不到有关创建此网址的示例。
http://stackoverflow.com/questions/7467568/parsing-json-from-url
http://stackoverflow.com/questions/10500775/parse-json-from-httpurlconnection-object
http://en.proft.me/2013/12/5/how-parse-json-java/
但那些不行,因为我无法解析String
答案 0 :(得分:0)
您获得的文本是指示浏览器的脚本
因此,您需要通过添加Cookie标头将此Cookie添加到下一个请求中。它应该看起来像:
Cookie: BXID=AAAAAAUo78YKTFtc33JkgZ25mtq287qQum8hFjskkvwbnF0MBw==