Ciao 访客, welcome back to old school! :p
应用信息保存成功后,将会获得该应用的App Key和Secret Key,您可以通过这两个Key数据开始进行相关的技术开发工作。App Key是应用的唯一标识,开放平台通过App Key来鉴别应用的身份。 AppSecret是给应用分配的密钥,开发者需要妥善保存这个密钥,这个密钥用来保证应用来源的的可靠性,防止被伪造。
String query = "processing";//需要查询的关键词String app_key = "3709681010";//这是vinjn自己申请的app_key,请勿滥用String url = "http://api.t.sina.com.cn/statuses/search.xml?source="+app_key+"&q="+query;//新浪微博的查询接口String[] result = loadStrings(url);//loadStrings不仅能读取本地文本,也能读取网络上的urlprintln(result);//显示返回的xml文件中的内容saveStrings("weibo.xml",result);//写入到weibo.xml中
saveStrings("weibo.xml",loadStrings("http://api.t.sina.com.cn/statuses/search.xml?source=3709681010&q=processing"));
String url = "http://api.t.sina.com.cn/users/show/11051.xml?source=1594162296";String[] result = loadStrings(url);println(result);
So......具体如何操作
String QUERY = "http://www.google.de/search?q=Processing";void setup(){ String[] results = null; try { URL url= new URL(QUERY); URLConnection connection = url.openConnection(); // Google rejects pure API requests, so we change the header of the request // to make it believe it is requested by a real browser... :) connection.setRequestProperty("User-Agent", "I am a real browser like Mozilla or MSIE" ); results = loadStrings(connection.getInputStream()); } catch (Exception e) // MalformedURL, IO { e.printStackTrace(); } if (results != null) { println(results[2]); }}