You need a auth token to be able to use this api. You can generate one by registering here, and generating the token from the profile page.
Once you have the token you can pass it as a bearer token in `Authorization` header. Examples are given at the bottom of the page.
curl "https://api.irkfdb.in/fact/random" \ -H 'Authorization: Bearer <auth-token-to-be-replaced-here>' \ -H 'Accept: application/json'
// get cURL resource $ch = curl_init(); // set url curl_setopt($ch, CURLOPT_URL, 'https://api.irkfdb.in/fact/random'); // set method curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET'); // return the transfer as a string curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // set headers curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Authorization: Bearer 52eQyshKcoujeAzB56Yd2BaPAmEboUCmmLiE7AhqOTD7uhZQHINIS0FUNvHJCWtPVHRTdDV5J9GbXnCl', 'Accept: application/json', ]); // send the request and save response to $response $response = curl_exec($ch); // stop if fails if (!$response) { die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch)); } echo 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL; echo 'Response Body: ' . $response . PHP_EOL; // close curl resource to free up system resources curl_close($ch);