Log in fx

This commit is contained in:
dev-chiefworks
2022-04-02 21:45:24 -04:00
parent 251a27d75c
commit 472fbd2e64
2 changed files with 14 additions and 6 deletions
+7 -4
View File
@@ -111,9 +111,9 @@ class Savvy extends BaseController
log_message('critical', "API-WAS CALLED user 009" );
// log_message('critical', json_encode($in) );
// log_message('critical', json_encode($_POST) );
log_message('critical', json_encode($in) );
log_message('critical', json_encode($_POST) );
$inx = $_POST;
switch ($endpoint) {
case 'getdrycleanservicelist': $in["action"] = SAVVYEXT_USER_DRYCLIST;
break;
@@ -124,7 +124,10 @@ class Savvy extends BaseController
$in["loc"] = $_SERVER["REMOTE_ADDR"];
break;
case 'userlogin': $in["action"] = SAVVYEXT_USER_LOGIN;
$res = FloatLogin::floatLoginUser();
//{"username":"ses66181@gmail.com","password":"12345678","sessionid":"DUMMYSESSION","loc":"172.24.0.1","pid":100}
$res = FloatLogin::floatLoginUser($inx['username'], $inx['password']);
if (!empty($res)){
$data = json_decode($res, TRUE);
+7 -2
View File
@@ -6,8 +6,12 @@ use GuzzleHttp\Client as HTTPClient;
class FloatLogin
{
public static function floatLoginUser()
public static function floatLoginUser($username,$password)
{
// {\"username\":\"test@float.sg\",\"password\":\"111111\",\"sessionid\":\"DUMMYSESSION\"}");
// "{'username':'$username','password':'$password',\"sessionid\":\"DUMMYSESSION\"}"
log_message('critical', "{'username':'$username','password':'$password',\"sessionid\":\"DUMMYSESSION\"}" );
// Generated by curl-to-PHP: http://incarnate.github.io/curl-to-php/
$ch = curl_init();
@@ -15,7 +19,8 @@ class FloatLogin
curl_setopt($ch, CURLOPT_URL, 'http://10.20.30.26:8000/api/v1/user/login');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"username\":\"test@float.sg\",\"password\":\"111111\",\"sessionid\":\"DUMMYSESSION\"}");
// curl_setopt($ch, CURLOPT_POSTFIELDS, "{'username':'$username','password':'$password',\"sessionid\":\"DUMMYSESSION\"}");
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"username\":\"$username\",\"password\":\"$password\",\"sessionid\":\"DUMMYSESSION\"}");
curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
$headers = array();