( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ
<?php
$messageX = urlencode($sanitizedQuery);
//STEP 2
//save the prompt
// URL to make the GET request to
$url = "https://www.thebrand.ai/TheBrandZ/AISearchAssistantV2.php?message=$messageX";
// Make the GET request using file_get_contents
$response = file_get_contents($url);
/*$newResponse = preg_replace("/[^a-zA-Z \s]+/", '', $response);
$newResponse = preg_replace('/[^A-Za-z0-9\-]/', ' ', $newResponse);;
$newResponse = str_replace(array("'"),'', $newResponse);*/
// Split the search query into individual search terms
$searchTerms = explode(",", $response);
$term1 = trim($searchTerms[0]);
$term2 =trim($searchTerms[1]);
// Construct the SQL query using search terms
$sql = "SELECT * FROM profilepicture WHERE (tags LIKE '%$term1%' OR title LIKE '%$term1%') and public=1 and isdisplay=13 and catalogid=152 and is_deleted=0 and id >12802 limit 0,10";
// Remove the trailing "OR" at the end of the SQL query
$resultX = mysqli_query($videoondemand, $sql);
while ($rowX = mysqli_fetch_assoc($resultX)) {
$resultsID .= $rowX['id'].",";
}
// Separate the numbers into an array
$number_array = explode(",", $resultsID);
// Count the number of values in the array
$count = count($number_array);
// Pick a random number from the array
$random_number = $number_array[rand(0, $count - 2)];
// Print the result
$selectedID = $random_number;
?>