(URGENT) Using URLConnection to POST login information

D

duane

Dear Expert:

I am working on a program that would allow me to login to my yahoo
account using
URLconnection Java object. I have been able to get into the login page
but was not able to send the username and password.

The main problem is I don't know the name of the script that I should
send my username and password to. Is there a way to find out what
would be the script that is used by them (Yahoo) to authenticate the
username and password?

Below is the program:
===============================================================================
protected void sendUserName()
{
//NOTE: Mine should look something like this:
// URL url = new
URL("http://www.javacourses.com/cgi-bin/names.cgi");
// But I have problem finding out the script used by Yahoo to
do
// the authentication
URL url = new URL("http://mail.yahoo.com");
HttpURLConnection connection = (HttpURLConnection)
url.openConnection();
connection.setRequestMethod("POST");
connection.setDoOutput(true);
PrintWriter out = new
PrintWriter(connection.getOutputStream());

// Encode the message
String login = "login="+URLEncoder.encode("myUserName",
"UTF-8");
String pwd = "passwd="+URLEncoder.encode("myPasswd", "UTF-8");

// Send the encoded message
out.println(login+"&"+pwd);
out.close();
BufferedReader in = new BufferedReader(
new InputStreamReader(connection.getInputStream()));
String line;
while ((line = in.readLine()) != null) {
System.out.println(line);
}
in.close();
}
}
============================================================================
 
L

Lothar Kimmeringer

The main problem is I don't know the name of the script that I should
send my username and password to. Is there a way to find out what
would be the script that is used by them (Yahoo) to authenticate the
username and password?

Your browser.


Regards, Lothar
--
Lothar Kimmeringer E-Mail: (e-mail address removed)
PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)

Always remember: The answer is forty-two, there can only be wrong
questions!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,150
Members
46,697
Latest member
AugustNabo

Latest Threads

Top