I have multiple laravel applications(App1,App2...) with separate database connection with different table and columns.All other applications uses App1 to check the session is active or not and continue the process.
Here I am using PHP Curl API in App2 laravel middleware which executes on each page load and get session status from App1 to continue
But the API calls uses the users table in App2 to search instead of App1 users table
I tried using POST and GET method but both returns unknown column 'session_id' in users table
But the same API calls returns true or false when used in POSTMAN
GET REQUEST:
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_close($ch);
POST REQUEST:
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array( 'Content-Type: application/x-www-form-urlencoded', ));
curl_setopt($curl, CURLOPT_TIMEOUT, 120);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
I need to output as true in APP2 curl output used in middleware
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire