Site-to-Site-Link
Creating the token
Remote authentication
function create_contact( $fields ) {
$token = "token from the Site to Site link";
$site_key = md5($token . "example.disciple.tools" . "example.com");
$transfer_token = md5($site_key . date('Y-m-dH'));
$url = 'https://example.disciple.tools/wp-json/dt-posts/v2/contacts';
$req = curl_init();
curl_setopt_array($req, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode($fields),
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json",
"cache-control: no-cache",
"Authorization: Bearer " . $transfer_token
),
));
$response = curl_exec($req);
return json_decode($response);
}Connection Types
Last updated