httpのPOSTリクエストでビデオURLを送信しようとしていますが、私のためには機能しません。私は何か非常にシンプルなものを欠いている?HTTP POSTのアンドロイドアプリのデータなし
public void postVideoURL() throws IOException {
String encodedUrl = URLEncoder.encode("http://video.ted.com/talks/podcast/DavidBrooks_2011.mp4", "UTF-8");
URL obj = new URL("http://10.50.0.105:8060/launch/dev?url="+encodedUrl);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
//add request header
con.setRequestMethod("POST");
// Send post request
con.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(con.getOutputStream());
System.out.println(con.getResponseCode());
System.out.println(con.getResponseMessage());
wr.flush();
wr.close();
wr.write("");
}
正しい方向に私を導くヒントはありますか?ここで
私がやろうとしているものですが、C#で
using System.Net;
using System.Web;
class Program
{
static void Main()
{
string rokuIp = "192.168.0.6";
string channelId = "dev";
string videoUrl = "http://video.ted.com/talks/podcast/DavidBrooks_2011.mp4";
// Note that the query string parameters should be url-encoded
string requestUrl = $"http://{rokuIp}:8060/launch/{channelId}?url={HttpUtility.UrlEncode(videoUrl)}";
using (var wc = new WebClient())
{
// POST the query string with no data
wc.UploadString(requestUrl, "");
}
}
}
次のポストは、端末作品に使用するコマンド、これは私が何をしたいのか、本質的にですが、Javaで: カール-d "" "http://10.50.0.46:8060/launch/12?url=http%3A%2F%2Fvideo.ted.com%2Ftalks%2Fpodcast%2FDavidBrooks_2011.mp4"
は* * – njzk2
アプリが起動し動作していないが、ビデオがアプリに送信されていない定義し、エラーは私がテレビでアプリにビデオを送信しています、コードに現れていないされています。 (私はアンドロイドアプリとしてconnectionsdkを使用しています) – UnknownDistance
get urlをパラメータとして書き込みます。サーバーがそれを望むならOKです。 – greenapps