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 -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();