Solution:
Your Login function :
function Login($data){
include_once($_SERVER[‘DOCUMENT_ROOT’].’/sbx/wp-config.php’);
include_once($_SERVER[‘DOCUMENT_ROOT’].’/sbx/wp-load.php’);
include_once($_SERVER[‘DOCUMENT_ROOT’].’/sbx/wp-includes/wp-db.php’);
global $db;
global $json;
$credentials = array();
$secure_cookie=”;
$username=$_POST[‘user_login’];
$password=$_POST[‘user_pass’];
if ( !empty($_POST[‘remember’]) )
$credentials[‘remember’] = true;
else
$credentials[‘remember’] = false;
$secure_cookie = apply_filters( ‘secure_signon_cookie’, $secure_cookie, $credentials );
global $auth_secure_cookie;
$auth_secure_cookie = $secure_cookie;
add_filter(‘authenticate’, ‘wp_authenticate_cookie’, 30, 3);
$user = wp_authenticate($username, $password);
if ( ! is_wp_error($user) )
{
$json[‘success’] = true;
$json[‘data’] = $user;
} else {
$json[‘success’] = false;
$json[‘data’] = “Please Wrong Username And Password.”;
}
Your Curl format:
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL,”your_url”);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, “user_login=dcm&user_pass=123456&api=Login”);
curl_exec ($curl);
curl_close ($curl);