Hello.
The GAPI library provides a Project with several examples, some  for
translation API,  some for Search API etc.
I was using that project for testing, and if i change it to use POST,
it fails in the first Example.

The first Example URL is
http://ajax.googleapis.com/ajax/services/language/detect?v=1.0&q=Ciao+mondo

Best regards,
Sérgio

On 23 Set, 12:14, Jeremy Geerdes <[email protected]> wrote:
> What URL are you requesting?
>
> Jeremy R. Geerdes
> Effective website design & development
> Des Moines, IA
>
> For more information or a project quote:http://jgeerdes.home.mchsi.com
> [email protected]
>
> If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan 
> Church!
>
> On Sep 23, 2010, at 4:44 AM, srgloureiro wrote:
>
>
>
> > Thank you very much. But when I change the method ogf GAPI to be POST
> > and fill the HTTP web request headers with its values, I get an error
> > "405: Method not allowed". What can I do to specifically addres this
> > issue?
>
> > The code (in C#), after I did the changes to GAPI, is pasted below:
>
> >        public static HttpWebRequest BuildWebRequest(string url)
> >        {
> >            HttpWebRequest webRequest =
> > (HttpWebRequest)WebRequest.Create(url);
> >            webRequest.Method = "POST";
> >            webRequest.ContentLength = url.Length;
> >            webRequest.ContentType = "application/x-www-form-
> > urlencoded";
> >            webRequest.ProtocolVersion = HttpVersion.Version10;
> >            webRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0;
> > Windows NT 5.1)";
>
> >            try
> >            {
> >                using (Stream writeStream =
> > webRequest.GetRequestStream())
> >                {
> >                    byte[] bytes = Encoding.UTF8.GetBytes(url);
> >                    writeStream.Write(bytes, 0, bytes.Length);
> >                    writeStream.Close();
> >                }
> >            }
> >            catch (Exception)
> >            {
> >                throw new Exception("Não é possível ligar ao serviço
> > de tradução!");
> >            }
>
> >            if (CoreHelper.Proxy != null)
> >                webRequest.Proxy = CoreHelper.Proxy;
> >            else
> >            {
> >                IWebProxy proxy = webRequest.Proxy;
> >                if (proxy != null)
> >                    proxy.Credentials =
> > CredentialCache.DefaultCredentials;
> >            }
>
> >            return webRequest;
> >        }
>
> >        public static string PerformRequest(string url)
> >        {
> >            HttpWebRequest request =
> > (HttpWebRequest)CoreHelper.BuildWebRequest(url);
>
> >            using (HttpWebResponse response =
> > (HttpWebResponse)request.GetResponse())
>
> >            using (StreamReader reader = new
> > StreamReader(response.GetResponseStream()))
> >            {
> >                return reader.ReadToEnd();
> >            }
> >        }
>
> > Best regards,
> > Sérgio
>
> > On 22 Set, 20:19, Jeremy Geerdes <[email protected]> wrote:
> >> In order to utilize the full 5,000-character string limit, you must submit 
> >> the request via the POST method. It should also be noted that the 5,000 
> >> characters are AFTER the string has been url-encoded. So if you have 
> >> special characters, etc., you may find your limit reduced dramatically.
>
> >> Jeremy R. Geerdes
> >> Effective website design & development
> >> Des Moines, IA
>
> >> For more information or a project quote:http://jgeerdes.home.mchsi.com
> >> [email protected]
>
> >> If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan 
> >> Church!
>
> >> On Sep 22, 2010, at 2:10 PM, srgloureiro wrote:
>
> >>> Hello.
> >>> I am trying to use Google API translation in C#, using the GAPI
> >>> library (it uses AJAX/JSON to communicate) .
>
> >>> The problem is what is the real limit of the string of the URL it
> >>> accepts?
> >>> Supposedly, reading the documentation, a person gets the idea of being
> >>> 5000. But, in practice, you can not pass a string with that length.
>
> >>> There are some folks in the Internet saying they can overcome the
> >>> limitation of 1400 characters. However, when I do my experimentations,
> >>> it seems the limit of the URL is 2073 or the limit of the query text
> >>> is 1990 characters.
>
> >>> I thank in advance to the person who gives the definitive answer, or
> >>> even better, to the person that can say how to  ask for requests with
> >>> a 5000 length query text.
>
> >>> Best regards,
> >>> Sérgio
>
> >>> --
> >>> You received this message because you are subscribed to the Google Groups 
> >>> "Google AJAX APIs" group.
> >>> To post to this group, send email to 
> >>> [email protected].
> >>> To unsubscribe from this group, send email to 
> >>> [email protected].
> >>> For more options, visit this group 
> >>> athttp://groups.google.com/group/google-ajax-search-api?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Google AJAX APIs" group.
> > To post to this group, send email to 
> > [email protected].
> > To unsubscribe from this group, send email to 
> > [email protected].
> > For more options, visit this group 
> > athttp://groups.google.com/group/google-ajax-search-api?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google AJAX APIs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-ajax-search-api?hl=en.

Reply via email to