Searched for advice on here for similar topics but nothing showed up
]]>i have tried with api , but it doesnot work ?
in laravel login function
//login user in WP help website
Http::post('https://subdomain/wp-json/userapi/v1/userLogin', [
'email' => auth()->user()->email,
]);
in functions.php in wordpress
public function userLogin (WP_REST_Request $request){
$email = $request->get_param('email');
$user = get_user_by('email', $email);
wp_set_auth_cookie($user->ID);
do_action( 'wp_login', $user->user_login, $user );
}
]]>https://www.mysite.it/ (Laravel)
https://www.mysite.it/wp/ (WordPress)
I have this Laravel function
class ProductController extends Controller
{
public function index(Request $request)
{
$curl = curl_init();
curl_setopt_array( $curl, array(
CURLOPT_URL => "https://site.test/wp/wp-json/cocart/v2/cart/items",
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => array(
'Accept: application/json',
'User-Agent: CoCart API/v2',
)
) );
$response = curl_exec($curl);
curl_close($curl);
echo $response;
}
}
But results is always “No items in the cart.”
I think that Laravel cannot read WordPress Sessions.
There is a way?
thanks!
]]>The systems worked flawlessly for over a year but after the last update, both plugin and api, I am getting a CSRF token mismatch error (419) when calling the api using wp_remote_post.
I am able to call the api from other clients , like Postman, but not through wordpress’ built in remote post method
]]>Can your plugin working to the other site (not wordpress ex: laravel)? Or this plugin working if each of sites using WordPress as their CMS?
]]>I really need help, thank you
the technology i use is laravel
]]>