Re: [twitter-dev] Re: Twitter status update through a Ajax Post
atomic mouse wrote: I replaced the first post here :: Hello Friends; In December I wrote a little function to allow users to update our Twitter status by completing a form embedded in our CMS. This has worked fine untill last week. The script simply sends a ajax post to "http://twitter.com/statuses/ update.xml" Unfortunately it returns the following error: Permission denied - line 13 Which is the line stating : axobj.open("POST",purl,false,"my username","my password"); *The "my username" and "my password" is replaced with the correct login details at runtime. Here is the complete test code: <%...@language="JAVASCRIPT" CODEPAGE="1252"%> function asp_twitter_update(strMsg) { var axobj,purl; purl = "http://twitter.com/statuses/update.xml";; axobj = new ActiveXObject("Microsoft.XMLHTTP"); axobj.open("POST",purl,false,"my username","my password"); axobj.setRequestHeader("Content-type", "application/x-www- form- urlencoded"); //axobj.setRequestHeader("Connection", "close"); axobj.send("status="+Server.URLEncode(strMsg)); } asp_twitter_update("This is the new status message to be posted"); Ajax cannot send to end points outside of your server. You have to use a local proxy. I guess the other problem is that you have no user agent specified. In any case, storing a username and password readable in JavaScript is a terrible idea. Anyone looking at the source of this page could send Tweets on your behalf.
[twitter-dev] Re: Twitter status update through a Ajax Post
I replaced the first post here :: Hello Friends; In December I wrote a little function to allow users to update our Twitter status by completing a form embedded in our CMS. This has worked fine untill last week. The script simply sends a ajax post to "http://twitter.com/statuses/ update.xml" Unfortunately it returns the following error: Permission denied - line 13 Which is the line stating : axobj.open("POST",purl,false,"my username","my password"); *The "my username" and "my password" is replaced with the correct login details at runtime. Here is the complete test code: <%...@language="JAVASCRIPT" CODEPAGE="1252"%> function asp_twitter_update(strMsg) { var axobj,purl; purl = "http://twitter.com/statuses/update.xml";; axobj = new ActiveXObject("Microsoft.XMLHTTP"); axobj.open("POST",purl,false,"my username","my password"); axobj.setRequestHeader("Content-type", "application/x-www- form- urlencoded"); //axobj.setRequestHeader("Connection", "close"); axobj.send("status="+Server.URLEncode(strMsg)); } asp_twitter_update("This is the new status message to be posted");
[twitter-dev] Re: Twitter status update through a Ajax Post
I have replaced the first post in this thread here ::: Hello Friends; In December I wrote a little function to allow users to update our Twitter status by completing a form embedded in our CMS. This has worked fine untill last week. The script simply sends a ajax post to "http://twitter.com/statuses/ update.xml" Unfortunately it returns the following error: Permission denied - line 13 Which is the line stating : axobj.open("POST",purl,false,"my username","my password"); *The "my username" and "my password" is replaced with the correct login details at runtime. Here is the complete test code: <%...@language="JAVASCRIPT" CODEPAGE="1252"%> function asp_twitter_update(strMsg) { var axobj,purl; purl = "http://twitter.com/statuses/update.xml";; axobj = new ActiveXObject("Microsoft.XMLHTTP"); axobj.open("POST",purl,false,"my username","my password"); axobj.setRequestHeader("Content-type", "application/x-www- form- urlencoded"); //axobj.setRequestHeader("Connection", "close"); axobj.send("status="+Server.URLEncode(strMsg)); } asp_twitter_update("This is the new status message to be posted");
[twitter-dev] Re: Twitter status update through a Ajax Post
Hello Friends; In December I wrote a little function to allow users to update our Twitter status by completing a form embedded in our CMS. This has worked fine untill last week. The script simply sends a ajax post to "http://twitter.com/statuses/ update.xml" Unfortunately it returns the following error: Permission denied - line 13 Which is the line stating : axobj.open("POST",purl,false,"my username","my password"); *The "my username" and "my password" is replaced with the correct login details at runtime. Here is the complete test code: <%...@language="JAVASCRIPT" CODEPAGE="1252"%> function asp_twitter_update(strMsg) { var axobj,purl; purl = "http://twitter.com/statuses/update.xml";; axobj = new ActiveXObject("Microsoft.XMLHTTP"); axobj.open("POST",purl,false,"my username","my password"); axobj.setRequestHeader("Content-type", "application/x-www- form- urlencoded"); //axobj.setRequestHeader("Connection", "close"); axobj.send("status="+Server.URLEncode(strMsg)); } asp_twitter_update("This is the new status message to be posted");
Re: [twitter-dev] Re: Twitter status update through a Ajax Post
Looks like cross server Ajax to me. Can't do that because of the same origin design of Ajax. Not sure how it worked before (unless running locally.) Unless my tired eyes are lieing to me, you are not running this inside ASP (runat=server) so that JS is running in the browser. On Feb 12, 2010 9:07 PM, "atomic mouse" wrote: Thank you very much for your reply Raffi. > is this hosted somewhere so we can hit it with a browser Yes certainly, it is on http://www.dinkumsite.com/twitter_feed.asp I have created a Twitter test account and inserted the correct username and password in the code. To discount the possibility that it might be some weird server setting, I have also published this test page to 2 seperate servers. I got the same error on both Regards;
[twitter-dev] Re: Twitter status update through a Ajax Post
Thank you very much for your reply Raffi. > is this hosted somewhere so we can hit it with a browser Yes certainly, it is on http://www.dinkumsite.com/twitter_feed.asp I have created a Twitter test account and inserted the correct username and password in the code. To discount the possibility that it might be some weird server setting, I have also published this test page to 2 seperate servers. I got the same error on both Regards;