samsina
08-30-2007, 11:40 PM
hello guys....
at work i have to develop this user authentication. they have provided me with a link that make REST method calls to user/pass and if correct then dumps true to the page or some false message otherwise.
for example:
http://www.example.com/auth?user=admin&pass=password
my problem is that i don't know how to make html reqeust with php and google didn't help since i am not searching with correct key words.
here is what i would do in java:
HttpClient client = new HttpClient();
PostMethod method = new PostMethod("http://www.example.com/auth?userid=admin&pwd=password");
method.setParameter("userid",username); //username, password supposedly defined.
method.setParameter("pwd",password);
try {
client.executeMethod(method);
} catch (Exception e) {
e.printStackTrace();
}
String result = method.getResponseBodyAsString();
create = ((result != null) &&
(result.indexOf("True") > -1));
} '
any help is appreciated.
thanks.
at work i have to develop this user authentication. they have provided me with a link that make REST method calls to user/pass and if correct then dumps true to the page or some false message otherwise.
for example:
http://www.example.com/auth?user=admin&pass=password
my problem is that i don't know how to make html reqeust with php and google didn't help since i am not searching with correct key words.
here is what i would do in java:
HttpClient client = new HttpClient();
PostMethod method = new PostMethod("http://www.example.com/auth?userid=admin&pwd=password");
method.setParameter("userid",username); //username, password supposedly defined.
method.setParameter("pwd",password);
try {
client.executeMethod(method);
} catch (Exception e) {
e.printStackTrace();
}
String result = method.getResponseBodyAsString();
create = ((result != null) &&
(result.indexOf("True") > -1));
} '
any help is appreciated.
thanks.