Update Saqel Platform: 2026-08-29 02:03:07
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
$envFile = __DIR__ . '/../.env';
|
||||
if (file_exists($envFile)) {
|
||||
$lines = file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
foreach ($lines as $line) {
|
||||
if (strpos(trim($line), '#') === 0) continue;
|
||||
list($name, $value) = explode('=', $line, 2);
|
||||
putenv(trim($name) . '=' . trim($value));
|
||||
}
|
||||
}
|
||||
$apiKey = getenv('GEMINI_API_KEY');
|
||||
$keys = explode(',', $apiKey);
|
||||
$apiKey = trim($keys[0]);
|
||||
$url = "https://generativelanguage.googleapis.com/v1beta/models/gemini-flash-lite-latest:generateContent?key={$apiKey}";
|
||||
$ch = curl_init($url);
|
||||
curl_setopt_array($ch, [
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => json_encode(['contents' => [['parts' => [['text' => 'hello']]]]]),
|
||||
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
]);
|
||||
$res = curl_exec($ch);
|
||||
echo "Response: $res\n";
|
||||
Reference in New Issue
Block a user