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官方文件。