<?php

$curl = curl_init();

curl_setopt_array($curl, [
	CURLOPT_URL => "https://age-detection2.p.rapidapi.com/age",
	CURLOPT_RETURNTRANSFER => true,
	CURLOPT_ENCODING => "",
	CURLOPT_MAXREDIRS => 10,
	CURLOPT_TIMEOUT => 30,
	CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
	CURLOPT_CUSTOMREQUEST => "POST",
	CURLOPT_POSTFIELDS => json_encode([
		'image' => 'https://howolddoyoulook.com/static/images/b.jpg',
		'return_face' => null
	]),
	CURLOPT_HTTPHEADER => [
		"X-RapidAPI-Host: age-detection2.p.rapidapi.com",
		"X-RapidAPI-Key: 87a4575688mshbdf46f5c004cb04p1bf2bcjsnbea23294780c",
		"content-type: application/json"
	],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
	echo "cURL Error #:" . $err;
} else {
	echo $response;
}