-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.sh
48 lines (42 loc) · 1.46 KB
/
action.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
static string HTTPPost(string sUrl, string sRequest)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(sUrl);
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = sRequest.Length;
request.GetRequestStream().Write(Encoding.UTF8.GetBytes(sRequest), 0, sRequest.Length);
request.GetRequestStream().Close();
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
string result = reader.ReadToEnd();
reader.Close();
return result;
}
static void Main_Encoding(string origin, string destination)
{
string xml, sUrl, sRequest, result, userID, userKey;
//put your real userID and userKey below
userID = "0";
userKey = "your_key";
xml = string.Format(
@"<?xml version=""1.0""?>
<query>
<userid>{0}</userid>
<userkey>{1}</userkey>
<action>AddMedia</action>
<source>{2}</source>
<format>
<output>flv</output>
<destination>{3}</destination>
</format>
</query>", userID, userKey, origin, destination);
sUrl = "http://manage.encoding.com/";
sRequest = "xml=" + HttpUtility.UrlEncode(xml);
result = HTTPPost(sUrl, sRequest);
}
static void Main(string[] args)
{
String origin = "http://yoursite.com/video/movie.avi";
String destination = "ftp://username:password@yourftphost.com/video/encoded/test.flv";
Main_Encoding(origin, destination);
}