This is file which is use to login on joomla site.
// a super-stripped down 2-leg oauth server/client example
function getLogin($userid, $psswrd) {
$app = JFactory::getApplication();
jimport('joomla.user.authentication');
jimport('joomla.session.session');
$auth = &JAuthentication::getInstance();
$session = &JFactory::getSession();
$session->set('name', "value");
$ssn_name = $session->get('name');
$sessionDetails = array(
'State' => $session->getState(),
'Expire' => session->getExpire(),
'Token' => $session->getToken(),
'FormToken' => $session->getFormToken(),
'Name' => $session->getName(),
'Id' => $session->getId(),
'getStores' => $session->getStores(),
'isNew' => $session->isNew());
$username = $userid;
$password = $psswrd;
$credentials = array(
'username' => $username,
'password' => $password);
$options = array();
$response = $auth->authenticate($credentials, $options);
if ($response->status == JAUTHENTICATE_STATUS_SUCCESS) {
$response->status = true;
$sessionDetails['loginStatus'] = $loginStatus = $app->login($credentials, $options);
return $sessionDetails;
}
else {
$response->status = false;
return 'testFalse';
}
}
Now we are calling this using localhost by
$client = new nusoap_client("http://domain-name/site-name/nusoap/remoteLogin.php");
$error = $client->getError();
if ($error) {
echo "<h2>Constructor error</h2><pre>" . $error . "</pre>";
}
$result = $client->call("getLogin", array(
"userid" => "admin",
"password" => "test"));
After this session is created at above project and update it in database with new entry. But still not login on site. Can anyone help me.
Thanks
Ok, as Brent Friar posted and elin cited, you need to
Here is the code needed to accomplish all of this:
This should work on any Joomla website as long as the URL used in the script has a login form on the page. Once you run this script you should then be able to access the website and be logged in.
Hi @Devjohn please check my url you can test your local simple how to soap access remote.
you can find here my bolg to you problem i think it may help you
http://phptechnicalgroups.blogspot.in/2012/10/json-return-using-soap-server-and-soap.html