Aller au contenu

Extraits de code PHP pour l’API Numérologie Dakidarts

Ces exemples montrent comment appeler les endpoints Core, Karmiques, Cycles et Horoscope avec PHP (cURL) et votre clé RapidAPI.


Configuration de base

<?php
$headers = [
    "x-rapidapi-key: VOTRE_CLE_RAPIDAPI",
    "Content-Type: application/json"
];

function sendGetRequest($url, $params = []) {
    global $headers;
    $query = http_build_query($params);
    $ch = curl_init("$url?$query");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    $response = curl_exec($ch);
    curl_close($ch);
    return json_decode($response, true);
}

function sendPostRequest($url, $payload = []) {
    global $headers;
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
    $response = curl_exec($ch);
    curl_close($ch);
    return json_decode($response, true);
}
?>

Exemple 1 : Nombre d’Attitude

<?php
$url = "https://the-numerology-api.p.rapidapi.com/attitude_number";
$params = ["birth_day" => "14", "birth_month" => "3"];
$response = sendGetRequest($url, $params);
print_r($response);
?>

Exemple 2 : Nombre de Défi

<?php
$url = "https://the-numerology-api.p.rapidapi.com/challenge_number/post";
$payload = ["birth_year" => 1990, "birth_month" => 5, "birth_day" => 15];
$response = sendPostRequest($url, $payload);
print_r($response);
?>

Exemple 3 : Dette Karmique

<?php
$url = "https://the-numerology-api.p.rapidapi.com/karmic_debt";
$params = ["birth_year" => "2023", "birth_month" => "6", "birth_day" => "28"];
$response = sendGetRequest($url, $params);
print_r($response);
?>

Exemple 4 : Leçons Karmiques

<?php
$url = "https://the-numerology-api.p.rapidapi.com/karmic_lessons";
$params = ["full_name" => "John Doe Smith"];
$response = sendGetRequest($url, $params);
print_r($response);
?>

Exemple 5 : Chemin de Vie

<?php
$url = "https://the-numerology-api.p.rapidapi.com/life_path";
$params = ["birth_year" => "1990", "birth_month" => "5", "birth_day" => "12"];
$response = sendGetRequest($url, $params);
print_r($response);
?>

Exemple 6 : Nombre de Personnalité

<?php
$url = "https://the-numerology-api.p.rapidapi.com/personality_number/post";
$payload = ["first_name" => "John", "middle_name" => "Robert", "last_name" => "Doe"];
$response = sendPostRequest($url, $payload);
print_r($response);
?>

Exemple 7 : Nombre de Destinée

<?php
$url = "https://the-numerology-api.p.rapidapi.com/destiny_number";
$params = ["first_name" => "John", "middle_name" => "Doe", "last_name" => "Smith"];
$response = sendGetRequest($url, $params);
print_r($response);
?>

Exemple 8 : Désir du Cœur

<?php
$url = "https://the-numerology-api.p.rapidapi.com/heart_desire";
$params = ["first_name" => "John", "middle_name" => "Robert", "last_name" => "Doe"];
$response = sendGetRequest($url, $params);
print_r($response);
?>

Exemple 9 : Année Personnelle

<?php
$url = "https://the-numerology-api.p.rapidapi.com/personal_year";
$params = ["prediction_year" => "2025", "birth_month" => "12", "birth_day" => "3"];
$response = sendGetRequest($url, $params);
print_r($response);
?>

Exemple 10 : Lecture Ancestrale

<?php
$url = "https://the-numerology-api.p.rapidapi.com/ancestor-reading";
$params = ["family_name" => "Etuge"];
$response = sendGetRequest($url, $params);
print_r($response);
?>

Exemple 11 : Plans d’Expression

<?php
$url = "https://the-numerology-api.p.rapidapi.com/planes-of-expression";
$payload = ["fullname" => "Jesus Christ"];
$response = sendPostRequest($url, $payload);
print_r($response);
?>

Exemple 12 : Horoscope du jour

<?php
$url = "https://the-numerology-api.p.rapidapi.com/horoscope/today";
$params = ["dob" => "2002-02-22"];
$response = sendGetRequest($url, $params);
print_r($response);
?>

Exemple 13 : Horoscope Carrière du jour

<?php
$url = "https://the-numerology-api.p.rapidapi.com/horoscope/career/today";
$payload = ["dob" => "1995-08-20"];
$response = sendPostRequest($url, $payload);
print_r($response);
?>

Exemple 14 : Horoscope Santé du jour

<?php
$url = "https://the-numerology-api.p.rapidapi.com/horoscope/health/today";
$params = ["dob" => "1995-08-20"];
$response = sendGetRequest($url, $params);
print_r($response);
?>

Exemple 15 : Horoscope Planétaire Quotidien

<?php
$url = "https://the-numerology-api.p.rapidapi.com/horoscope/planetary/daily";
$params = ["dob" => "1990-01-01", "day" => "today"];
$response = sendGetRequest($url, $params);
print_r($response);
?>

Exemple 16 : Cycle d’Essence (10 ans)

<?php
$url = "https://the-numerology-api.p.rapidapi.com/essence-cycle";
$params = [
    "full_name" => "Alexander Graham Bell",
    "dob" => "1847-03-03",
    "start_year" => "1847"
];
$response = sendGetRequest($url, $params);
print_r($response);
?>

Exemple 17 : Transits annuels

<?php
$url = "https://the-numerology-api.p.rapidapi.com/transits";
$payload = [
    "full_name" => "Alexander Graham Bell",
    "dob" => "1847-03-03"
];
$response = sendPostRequest($url, $payload);
print_r($response);
?>

Notes importantes

  • Tous les endpoints supportent GET et POST (quand applicable).
  • Remplacez "VOTRE_CLE_RAPIDAPI" par votre clé valide RapidAPI.
  • Utilisez $params pour les requêtes GET et $payload (JSON) pour les POST.