Skip to content

encoding/Encoding.com-C-API-Wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Encoding.com XML API Wrappers
==============
 
This plugin connects to the Encoding.com API for pay as you go cloud based video transcoding services.
 
Requires a API Key and User ID from Encoding.com.  30day adn 1GB free trial available at www.encoding.com/signup
 
Examples:

	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;
	    
	    userID = "777";
	    userKey = "277e0d0sdfaaa9140a27c03419f5era";
	               
	    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);
	}
	
Copyright (c) 2009 Encoding.com Inc. 

About

C# code that will send XML requests to encoding.com

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published