public string HTMLGetAuthor(string html, string url, BaseParams parameters) { CheckHTML(html, url); parameters.Html = html; parameters.Url = url; return POST("HTMLGetAuthor", "html", parameters); }
private string POST(string callName, string callPrefix, BaseParams parameters) { // callMethod, callPrefix, ... params Uri address = new Uri(_requestUri + callPrefix + "/" + callName); HttpWebRequest wreq = (HttpWebRequest)WebRequest.Create(address); wreq.Method = WebRequestMethods.Http.Post; wreq.ContentType = "application/x-www-form-urlencoded"; wreq.Headers.Add("Accept-encoding", "gzip,deflate"); wreq.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; StringBuilder d = new StringBuilder(); d.Append("apikey=").Append(_apiKey).Append(parameters.getParameterString()); parameters.ResetBaseParams(); byte[] bd = Encoding.UTF8.GetBytes(d.ToString()); wreq.ContentLength = bd.Length; using (Stream ps = wreq.GetRequestStream()) { ps.Write(bd, 0, bd.Length); } return DoRequest(wreq, parameters.OutputMode); }
public string URLGetTitle(string url, BaseParams parameters) { CheckURL(url); parameters.Url = url; return GET("URLGetTitle", "url", parameters); }
private string GET(string callName, string callPrefix, BaseParams parameters) { // callMethod, callPrefix, ... params StringBuilder uri = new StringBuilder(); uri.Append(_requestUri).Append(callPrefix).Append("/").Append(callName); uri.Append("?apikey=").Append(_apiKey).Append(parameters.getParameterString()); parameters.ResetBaseParams(); Uri address = new Uri(uri.ToString()); HttpWebRequest wreq = (HttpWebRequest) WebRequest.Create(address); wreq.Method = "GET"; return DoRequest(wreq, parameters.OutputMode); }
public string URLGetTextSentiment(string url, BaseParams parameters) { CheckURL(url); parameters.Url = url; return GET("URLGetTextSentiment", "url", parameters); }
public string URLGetMicroformats(string url, BaseParams parameters) { CheckURL(url); parameters.Url = url; return GET("URLGetMicroformatData", "url", parameters); }
public string URLGetFeedLinks(string url, BaseParams parameters) { CheckURL(url); parameters.Url = url; return GET("URLGetFeedLinks", "url", parameters); }
public string TextGetTextSentiment(string text, BaseParams parameters) { CheckText(text); parameters.Text = text; return POST("TextGetTextSentiment", "text", parameters); }
public string HTMLGetMicroformats(string html, string url, BaseParams parameters) { CheckHTML(html, url); parameters.Html = html; parameters.Url = url; return POST("HTMLGetMicroformatData", "html", parameters); }