php bard api
1.0.1
❗此存儲庫已存檔❗
https://ai.google.dev/
通過API返回Google Bard響應的軟件包
composer require pj8912/php-bard-api
Application選項卡Storage下的應用程序中,您會發現cookies dropdownhttps://bard.google.com ,它將向您顯示所有用作Name和Value cookie__Secure-1PSID和__Secure-1PSIDTS值
__Secure-1PSIDTS的值必須經常更改(Google更改)
require_once ' vendor/autoload.php ' ;
use Pj8912 PhpBardApi Bard ;
//two keys are required which are two cookies values
$ _ENV [ ' BARD_API_KEY_X ' ] = " value of cookie '__Secure-1PSID' " ;
$ _ENV [ ' BARD_API_KEY_Y ' ] = " value of cookie '__Secure-1PSIDTS' "
$ bard = new Bard();
$ input_text = " Hello , Bard !"; // Input text for the conversation
$ result = $ bard -> get_answer ( $ input_text ); // Get the response from Bard
// bard reply
print( $ result [ ' choices ' ][ 0 ][ ' content ' ][ 0 ]);該項目已根據麻省理工學院許可證
用戶承擔與使用Bardapi軟件包相關的所有法律責任。此PHP軟件包僅有助於為開發人員輕鬆訪問Google Bard。用戶負責管理數據並適當使用軟件包。有關更多信息,請諮詢Google Bard官方文件。