我想通过url将国家/地区和网络发送到我的Sql DB并返回短码以通过此短代码发送短信 我有以下Java代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Polymer Bin</title>
<script src="https://rawgit.com/webcomponents/webcomponentsjs/master/webcomponents.js"></script>
<base href="http://element-party.xyz/">
<link rel="import" href="all-elements.html">
</head>
<body class="fullbleed layout vertical">
<x-element style="width:100%; height: 100%;"></x-element>
<dom-module id="x-element">
<template>
<style>
</style>
<paper-header-panel class="flex">
<paper-toolbar ><span class="title">Header</span></paper-toolbar>
<div >
Content goes here...<br>
</div>
</paper-header-panel>
</template>
<script>
(function(){
Polymer({
is: 'x-element'
});
})();
</script>
</dom-module>
</html>
答案 0 :(得分:1)
您的代码中存在错误。试试这个:
url = new URL("http://93.95.207.35/SMS2App/sc.asp?country=" + country + "&operatorname=" + Network +"");
URLConnection conn = url.openConnection();
// open the stream and put it into BufferedReader
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
这通常是我阅读内容的方式:
line=in.readLine();
while (line!= null) {
result=result+line;
line=in.readLine();
}
//System.out.print(result);
in.close();
结果是你的网址中的字符串。