Wordpress show content only on certain condition
<p>I am working on site where I can show its content only for users registered in another DB. I managed to get an API response from the other system if the user exists or not but I don't really know how to continue the process. Can you guys please help me?</p>

<p>PS: I can't authenticate the user in the WP database, and I would like to keep the admin user login the way it is.</p>

<p>this is my API request:</p>

<pre><code>$username = '';
$password = '';
$token = '';
$url = "";
$cookie = "h8gkh8.txt";
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_COOKIEJAR, '/tmp/' . $cookie);
curl_setopt($ch, CURLOPT_COOKIEFILE, '/tmp/' . $cookie);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
if (curl_errno($ch))
    die(curl_error($ch));

$doc = new DOMDocument();
$doc-&gt;loadHTML($response);
$el = $doc-&gt;getElementsByTagName("input");

for ($i = 0; $i &lt; $el-&gt;length; $i++) {
    $attr = $el-&gt;item($i)-&gt;getAttribute('name');
    if ($attr == '_csrfhash') {
        $token = $el-&gt;item($i)-&gt;getAttribute('value');
    }
}

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($ch, CURLOPT_POST, 1);

$params = array(
    'scemail' =&gt; $username,
    'scpassword' =&gt; $password,
    '_csrfhash' =&gt; $token
);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));

$r = curl_exec($ch);


if (curl_errno($ch)) 
    print curl_error($ch);
</code></pre>