Would JSONP be a fit for your situation?

∞ Andy Badera
∞ +1 518-641-1280 Google Voice
∞ This email is: [ ] bloggable [x] ask first [ ] private
∞ Google me: http://www.google.com/search?q=andrew%20badera



On Mon, Mar 15, 2010 at 8:06 PM, Lawrence <lipeng...@gmail.com> wrote:
> Hi Everyone,
> I am developing a Twitter program,which needs to get access for the
> Twitter streaming API. I can use Http Clients (Apache Wink) to get
> data from streaming API with no problem.
>
> However, my application needs to use JavaScript to access the
> Streaming API and receive data. I got failure in the first step:
> trying to pass the basic auth... Instead, i always got the 401 reply
> from twitter streaming api (unauthorized)
>
> Here is some snippet from my code,
> function send(arg)
>            {
>               CreateXMLHttpRequest();
>               xmlhttp.onreadystatechange = callhandle;
>
> xmlhttp.open("GET",url);
>               xmlhttp.setRequestHeader("Authorization", "Basic
> bXXXXXXXyZWXXXXXTY4OTE4dHxxlc==");
>   // for my account security reason, i changed the string for my
> password and user name, but I am pretty sure the string in my original
> code is correct because I got it from the printing of my successful
> http clients example.
>               xmlhttp.send(arg);
>           }
>
> Is this because the cross-domain restriction? Is there any way which i
> can use JS to access the streaming API to obtain data?
>
> Cheers
> Lawrence
>

Reply via email to