<?php

function isValidApiResponse()
{
    $url = "https://p...content-available-to-author-only...r.com/api/v1/affiliate/getBasicDetails";

    $data = [
        "MobileNo" => "nGyulSschikrQE6kR+uVkg=="
    ];

    $headers = [
        "Content-Type: application/json",
        "Cookie: _abck=E24418EF155538F18D3DA91536273672~-1~YAAQ7AVaaKb8E/6RAQAAZQ0xBAzqAdu763o4eslwcV+vvNLwg4URhKTyMMNvpHwB2TL5mMTszCS2gAKofhgygfDS12eWVpZvU+ROaB9QjYNgEstkaSX6YQcpvcdSfm8vzEIzwGdsTFx1cSr6oMj4BkCD9S0aZVfPeqqJTWeDnnEJ2szsr+Qtw9+fEl0q9/AnoqB3QqUUeriDB6e6bfPUG/qY1Dux7S1XZtpT4zIvcgTpgpg9NG6L9WgQzZEWZ3pzb35g1MdbCLQtiXAAT30mEO2g7aSTQcbJRMS2qthsfbg3XTlp0ZL+pjc9BFREcBG3s1xgGYtGdO1tm3pP5IKTcSon3iaeQFlxnqd539ykt3MHWjpdOYa4FZyscHEG7a7dRYW8/h8dis4Mit/U3pNJZVD6~-1~-1~-1"
    ];

    // Initialize cURL session
    $ch = curl_init($url);

    // Set cURL options
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

    // Execute the request and capture the response
    $response = curl_exec($ch);

    // Check for cURL errors
    if ($response === false) {
        curl_close($ch);
        return false;
    }

    // Close cURL session
    curl_close($ch);

    // Decode the JSON response
    $responseData = json_decode($response, true);
    
    print_r($responseData);

    // Validate response data
    if (
        isset($responseData['error'], $responseData['data']) &&
        $responseData['error'] === false &&
        is_array($responseData['data']) &&
        count($responseData['data']) > 0
    ) {
        return true;
    } else {
        return false;
    }
}

// Call the function and display the result
$result = isValidApiResponse();
echo $result ? 'true' : 'false';
