We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › [HTTP]Basic Auth
Page Index Toggle Pages: 1
[HTTP]Basic Auth (Read 708 times)
[HTTP]Basic Auth
Oct 10th, 2007, 11:46pm
 
Hi !

I would like to know if it is possible to do a basic authentification with processing. And how ? Smiley I'm trying to connect twitter !

And how can i see the response of the twitter server ?

jb
Re: [HTTP]Basic Auth
Reply #1 - Oct 11th, 2007, 12:19am
 
in some cases you can use a url of the form:
http://user@host:www.blah.com/somepage.cgi
though that's probably less likely to work these days.

you could also write a simple class to do it by hand. i've done it in the past but there's not much point.

i'd recommend using the httpclient project from apache, which is a simple way to handle browser-like functionality from code:
http://jakarta.apache.org/httpcomponents/httpclient-3.x/
Re: [HTTP]Basic Auth
Reply #2 - Oct 11th, 2007, 9:34am
 
I've looked into projects that use the twitter api and it seems that http://USERNAME:PASSWORD@twitter.com:80/statuses/update.xml works. But i couldn't check because i don't know the response of the server if I use POST or get.
Re: [HTTP]Basic Auth
Reply #3 - Oct 11th, 2007, 2:27pm
 
calling loadStrings() will run the GET method on the provided URL and return the response from the server as a String[] array. doing a POST you'd have to build it by hand, or use the library i mentioned.
Re: [HTTP]Basic Auth
Reply #4 - Oct 11th, 2007, 6:27pm
 
@47108e

Here is the response of the server ? What for a problem is that ?

The code :

PClient twitter;
PRequest requete_twitter;

twitter= new PClient(this,"http://www.twitter.com");
     requete_twitter = twitter.POST("http://LOGIN:PASSWORD@twitter.com:80/statuses/update.xml",var2,val2);
     noLoop();

And I can't use the method readChar. It is in the reference... !

jb
Re: [HTTP]Basic Auth
Reply #5 - Oct 12th, 2007, 12:45pm
 
PClient and PRequest are not part of processing, perhaps you're using mobile processing or something else?
Re: [HTTP]Basic Auth
Reply #6 - Oct 12th, 2007, 5:34pm
 
yep, i use mobile processing. Sorry but i saw to late that I was in the wrong place !
Page Index Toggle Pages: 1