如何使用curl call api

I have 2 domain in server. I assume name : mydomain1 and mydomain2

mydomain2 call api in mydomain1 and mydomain2 use database in mydomain1

So. In mydomain2 I coding php file as follow:

$addLogLogin = "https://mydomain1.com/apis/setLogLogin";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $addLogLogin);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_exec($c);
curl_close($c);

and. File setLogLogin.php I coding php file as follow :

db_connect();
restoreSession();
updateLog($user_id,1);  //+1 number user and stored into database;

operation When compile file php in mydomain2. It call api setLogLogin.php in mydomain1. and fetch data user and update log in database

But It don't work for me.It not update Log in database. What is wrong?