Nextcloud remote user auth via php curl

Hello, everyone

I need realize synchronous user authorization of nextcloud and our website.

I want write user authorization script.
Is it possible do with php curl, if true, how i can do it?
Can you give example of code with curl authorization or another method of php auth

Great thanks