I have found the answer and it's pretty cheasy. The problem was that
with the UPDATE service that twitter provides it wants the
authorization header to be set to "Basic " + Bytes for logon
credentials

For the RATING service that twitter provides they want the entire
authorization header to be set as bytes... if you send either service
the authorization header in the wrong format it will not work
correctly. Sucks huh...

I was just sitting here trying to think of something that could be
wrong with the code when I decided to change that parament and got
lucky. Buy anyway here is the new code, it's almost exactly the same
as my previous post, please note that this code will ONLY work for the
RATING service, not the UPDATE service.

string logon="Basic " + this.UserName + ":" + this.Password;
logon=System.Convert.ToBase64String
(System.Text.Encoding.UTF8.GetBytes
(logon));


//request
HttpWebRequest req=(HttpWebRequest)WebRequest.Create(url);
req.Timeout=System.Convert.ToInt32(gen.Get("twitterTimeout"));
req.Headers.Add("Authorization",logon);
req.ServicePoint.Expect100Continue=false;


HttpWebResponse resp=(HttpWebResponse)req.GetResponse();
StreamReader sr=new StreamReader(resp.GetResponseStream
(),Encoding.GetEncoding(1252));


//get results
result=sr.ReadToEnd();
resp.Close();




On Nov 9, 11:07 am, "ch...@stuffworldwide.com"
<ch...@stuffworldwide.com> wrote:
> My program sends is usingrate_limit_status.xml to get the number of
> remaining hits until the account limit is exceeded. My problem is that
> it always seems to return the same value: 150. Even once I have
> already hit the limit the service continues to show 150 hits left. I
> am thinking that it is returning the hits remaining for the IP address
> and not the user account I need.
>
> Any ideas? I've been trying to figure this out all night but I haven't
> been able to find to many examples of therate_limit_status.xml
> service. Here is my code:
>
> string logon=this.UserName + ":" + this.Password;
> logon=System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes
> (logon));
>
> //request
> HttpWebRequest req=(HttpWebRequest)WebRequest.Create(url);
> req.Timeout=System.Convert.ToInt32(gen.Get("twitterTimeout"));
> req.Headers.Add("Authorization","Basic " + logon);
> req.ServicePoint.Expect100Continue=false;
>
> HttpWebResponse resp=(HttpWebResponse)req.GetResponse();
> StreamReader sr=new StreamReader(resp.GetResponseStream
> (),Encoding.GetEncoding(1252));
>
> //get results
> result=sr.ReadToEnd();
> resp.Close();
>
> The code XML response from twitter is:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <hash>
>   <remaining-hits type="integer">150</remaining-hits>
>   <hourly-limit type="integer">150</hourly-limit>
>   <reset-time-in-seconds type="integer">1257786363</reset-time-in-
> seconds>
>   <reset-time type="datetime">2009-11-09T17:06:03+00:00</reset-time>
> </hash>

Reply via email to