I'm using wordpress and I installed jwt.
My WordPress is installed on sub domain and I want to call jwt from the main domain.
when I call this URL from postman:
https://subdomain.domain.com/wp-json/jwt-auth/v1/token
it returns a response but when I call this URL from inside my main domain:
$url = 'https://subdomain.domain.com/wp-json/jwt-auth/v1/token';
$data = array(
'username' => '***',
'password' => '***'
);
$data_string = json_encode($data);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER ,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
$result = curl_exec($ch);
if (curl_errno($ch)) {
$error_msg = curl_error($ch);
}
curl_close($ch);
die("dd".$result.$error_msg);
it returns:
ddCould not resolve host: subdomain.domain.com
My DNS config:
A @ myip
CNAME www maindomain
A subdomain myip
where is the problem?