标签:
public string GetDwz(string Url)
{
Url = HttpUtility.UrlEncode(Url);
var data = "url=" + Url;
var url = "http://dwz.cn/create.php";
var client = new System.Net.WebClient();
client.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
var rs = client.UploadString(url, "POST", data);
var urlParam = HttpUtility.UrlDecode(rs);
Console.WriteLine(rs);
JavaScriptSerializer serializer = new JavaScriptSerializer();
Dictionary<string, object> json = (Dictionary<string, object>)serializer.DeserializeObject(urlParam);
object value;
json.TryGetValue("tinyurl", out value);
value = value == null ? json["longurl"] : value;
return value.ToString();
}
标签:
原文地址:http://www.cnblogs.com/l36i90u/p/5386451.html