1
这里是代码,看看哪些网址是安全浏览。我用它的谷歌API。 我面临的问题是我无法获得SafeBrowsing类对象来击中给定的URL。 所以请看看是否有人有解决方案。Google安全浏览v4 API java
public static void main(final String[] args) {
try {
final String baseURL = "https://safebrowsing.googleapis.com/v4/threatMatches:find?key=xxx";
final URL url = new URL(baseURL);
// Get a URLConnection object, to write to POST method
final HttpURLConnection connect = (HttpURLConnection) url.openConnection();
connect.setRequestMethod("POST");
connect.setRequestProperty("Content-Type", "application/json");
// Specify connection settings
connect.setDoInput(true);
connect.setDoOutput(true);
final ClientInfo clientInfo = new Ggooggle().getClientInfo();
final ThreatInfo threatInfo = new Ggooggle().getThreatInfo();
final FindThreatMatchesRequest request = new FindThreatMatchesRequest();
request.setClient(clientInfo);
request.setThreatInfo(threatInfo);
这将有助于增加findThreatMatchesRequest'如何'是建立。 – alexod
我将完整的示例代码添加到https://github.com/kalinchih/java_google_safebrowsing_v4 – kalin