decibel
08-16-2010, 07:36 PM
Hello,
I'm a php guy that needs to send an POST with a base64 encode MP3 to a ring tone service, how can I do this? Is using this code to send a post, how could I modify it to send an MP3 sitting on the local server.
protected void Page_Load(object sender, EventArgs e){
Uri uri = new Uri("http://myurl");
string data = "field-keywords=ASP.NET 2.0";
if (uri.Scheme == Uri.UriSchemeHttp){
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uri);
request.Method = WebRequestMethods.Http.Post;
request.ContentLength = data.Length;
request.ContentType = "application/x-www-form-urlencoded";
StreamWriter writer = new StreamWriter(request.GetRequestStream());
writer.Write(data);
writer.Close();
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
string tmp = reader.ReadToEnd();
response.Close();
Response.Write(tmp);
}
}
Thanks in advance for any tips.
I'm a php guy that needs to send an POST with a base64 encode MP3 to a ring tone service, how can I do this? Is using this code to send a post, how could I modify it to send an MP3 sitting on the local server.
protected void Page_Load(object sender, EventArgs e){
Uri uri = new Uri("http://myurl");
string data = "field-keywords=ASP.NET 2.0";
if (uri.Scheme == Uri.UriSchemeHttp){
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uri);
request.Method = WebRequestMethods.Http.Post;
request.ContentLength = data.Length;
request.ContentType = "application/x-www-form-urlencoded";
StreamWriter writer = new StreamWriter(request.GetRequestStream());
writer.Write(data);
writer.Close();
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
string tmp = reader.ReadToEnd();
response.Close();
Response.Write(tmp);
}
}
Thanks in advance for any tips.