Coder Social home page Coder Social logo

pj8912 / php-bard-api Goto Github PK

View Code? Open in Web Editor NEW
36.0 7.0 12.0 37 KB

The PHP package that returns response of Google Bard through API.

Home Page: https://packagist.org/packages/pj8912/php-bard-api

License: MIT License

PHP 100.00%
bard generative-ai google-bard php

php-bard-api's Introduction

php-bard-api

❗This repo is archived❗

Use Official Gemini API

https://ai.google.dev/

PHP composer bard package bard api composer version


A package that returns Response of Google Bard through API

Install

composer require pj8912/php-bard-api

Get Your Keys

  • Open bard.google.com
  • Open developer tools, click Application tab
  • In Application under the Storage you will find cookies dropdown
  • Under cookies click on https://bard.google.com which will show you all the cookies being used as Name and Value
  • Copy the values the cookies__Secure-1PSID and __Secure-1PSIDTS

Run

the value of __Secure-1PSIDTS will have to be changed frequently (Google changes it)

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]);

License

This project is licensed under the MIT License

Reference

Important Notice

The user assumes all legal responsibilities associated with using the BardAPI package. This PHP package merely facilitates easy access to Google Bard for developers. Users are solely responsible for managing data and using the package appropriately. For further information, please consult the Google Bard Official Document.

php-bard-api's People

Contributors

pixkk avatar pj8912 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-bard-api's Issues

Cookies dropdown missing?

Steps taken
Followed README instruction to locate described variables. URL is un-clickable, and/or described cookies dropdown is missing.

image

fpm-mode?

Is it possible that the project can be run under FPM environment?

Please help me in testing and integrating this api

Hi there,

I am a new developer. My task is to test this api for certain cases and if it passes then implement it.
would you please help me in doing the same as I have no idea how to start this?, I am struggling with the process and results.
Please help your fellow developer.
please share your email so that we can connect.
If you're willing to help we can connect online in a meet or something.

Thank you in advance.

Getting error: Failed to fetch SNlM0e

Hi maintainer.

I believe Google has updated Bard and the API's have changed. I saw your updates today but i applied the new changes and i still get this error:

[2023-07-15 21:54:33] local.ERROR: Failed to fetch SNlM0e

Thanks

Not getting value of __Secure-1PSIDTS

Hey there,

I am not getting the value of __Secure-1PSIDTS in my cookies. I can only see - __Secure-3PSIDCC , __Secure-1PSIDCC , __Secure-3PAPISID, __Secure-1PAPISID.

please help .

Undefined array key

When I attempted to input the query "Canadian university scholarships for international students 2023," I encountered an error.

Warning: Undefined array key 3" error in Bard.php on line 86
Screenshot_2

Image Link

Hi, this is wonderful. I've been having fun with it, many thanks.

How can the image links be parsed out and returned also?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.