Getnada有一个API-https://getnada.com/api/v1/inboxes/ {email-id}。我正在尝试使用此API进行电子邮件验证,但是,我没有得到响应,而是重定向到其他一些网页。
这是我的代码:
public Getnada(WebDriver driver, String testCaseId) {
super(driver, testCaseId);
}
public void getnadaJSON(){
String https_url = "https://getnada.com/api/v1/inboxes/ducazyx@getnada.com";
URL url;
try {
url = new URL(https_url);
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
SSLSocketFactory sslsocketfactory = (SSLSocketFactory) SSLSocketFactory.getDefault();
con.setSSLSocketFactory(sslsocketfactory);
InputStream in = new BufferedInputStream(con.getInputStream());
String result = IOUtils.toString(in, "UTF-8");
System.out.println(result);
in.close();
con.disconnect();
}catch (Exception e){
System.out.println(e);
}
}
这是我得到的错误:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Notification: Found</title>
</head>
<body>
<h1>This Page Cannot Be Displayed</h1>
<hr>
<p>
The page ( https://getnada.com/api/v1/inboxes/ducazyx@getnada.com )
is being redirected to ( http://10.175.231.148:11000/75eun.pl?Time=28%2FFeb%2F2019%3A20%3A12%3A40%20%2B0000&ID=959724547&Client_IP=10.137.92.76&User=-&Site=getnada.com&URI=api%2Fv1%2Finboxes%ducazyx@getnada.com&Status_Code=403&Decision_Tag=BLOCK_WEBCAT_12-DefaultGroup-Java_Execution-NONE-NONE-NONE-NONE&URL_Cat=Web-based%20Email&WBRS=-3.0&DVS_Verdict=-&DVS_ThreatName=-&Time_Based=0&Reauth_URL=- ).
</p>
<p>
If you are not automatically redirected to the new address,
click here: ( <a href="http://10.175.231.148:11000/75eun.pl?Time=28%2FFeb%2F2019%3A20%3A12%3A40%20%2B0000&ID=959724547&Client_IP=10.137.92.76&User=-&Site=getnada.com&URI=api%2Fv1%2Finboxes%ducazyx@getnada.com&Status_Code=403&Decision_Tag=BLOCK_WEBCAT_12-DefaultGroup-Java_Execution-NONE-NONE-NONE-NONE&URL_Cat=Web-based%20Email&WBRS=-3.0&DVS_Verdict=-&DVS_ThreatName=-&Time_Based=0&Reauth_URL=-">http://10.175.231.148:11000/75eun.pl?Time=28%2FFeb%2F2019%3A20%3A12%3A40%20%2B0000&ID=959724547&Client_IP=10.137.92.76&User=-&Site=getnada.com&URI=api%2Fv1%2Finboxes%ducazyx@getnada.com&Status_Code=403&Decision_Tag=BLOCK_WEBCAT_12-DefaultGroup-Java_Execution-NONE-NONE-NONE-NONE&URL_Cat=Web-based%20Email&WBRS=-3.0&DVS_Verdict=-&DVS_ThreatName=-&Time_Based=0&Reauth_URL=-</a> ).
</p>
<p>
If you have questions, or feel this is an error, please contact
your organization's network administrator
and provide the codes shown below.
</p>
<hr>
<table>
<tr valign="top">
<td valign="top" width="10%">Notification codes: </td>
<td valign="top" class="code" width="90%">(1, FOUND, http://10.175.231.148:11000/75eun.pl?Time=28%2FFeb%2F2019%3A20%3A12%3A40%20%2B0000&ID=959724547&Client_IP=10.137.92.76&User=-&Site=getnada.com&URI=api%2Fv1%2Finboxes%ducazyx@getnada.com&Status_Code=403&Decision_Tag=BLOCK_WEBCAT_12-DefaultGroup-Java_Execution-NONE-NONE-NONE-NONE&URL_Cat=Web-based%20Email&WBRS=-3.0&DVS_Verdict=-&DVS_ThreatName=-&Time_Based=0&Reauth_URL=-, https://getnada.com/api/v1/inboxes/ducazyx@getnada.com)</td>
</tr>
</table>
</body>
</html>
在此错误消息中,我注意到url中看起来像是空格。我觉得这就是问题所在。