I'm trying to determine whether the user name and password I've sent to a php login form is valid. I've read some posts that suggest looking at the response text and checking for the title of the page that is returned. Other posts mention using a session ID in some way. Just what is the best way to detrmine if the user name/password combo is valid once I've posted to the form? Any help would be greatly appreciated. Thanks in advance.
Update...
I was able to resolve this issue using the following code snippet:
response = httpClient.execute(httpPost);
cookies = ((AbstractHttpClient) httpClient).getCookieStore ();
myCookie = cookies.getCookies ();
// if cookies are empty, login did not work.
if (!myCookie.isEmpty ())
{
for (int i = 0; i < myCookie.size(); i++)
{
String str = myCookie.get(i).toString();
// look for PHP session cookie and save it.
if (str.contains ("PHPSESSID"))
{
phpsessid = myCookie.get (i).toString ();
int index = phpsessid.indexOf("value");
phpsessidGuid = phpsessid.substring(index+7, index+39);
}
}
}
Hope this helps others with the same problem.