Closed hakkikonu closed 5 years ago
you dont need to store cookies at the db
the bot create cookies file for each user based on the username/email and for each user login session the bot check if the cookies file is created to reuse it and prevent a new login request
you can set cookies path with $bot->getHttpClient()->setCookiesPath($yourCustomPathForCookies);
you can get all cookies by :
$bot->getHttpClient()->cookies(); => save it to db
the bot create cookies file for each user based on the username/email and for each user login session the bot check if the cookies file is created to reuse it and prevent a new login request
Please @tuxado provide a sample code to use cookies to log in thereby preventing new entry requests
the bot create cookies file for each user based on the username/email and for each user login session the bot check if the cookies file is created to reuse it and prevent a new login request
Please @tuxado provide a sample code to use cookies to log in thereby preventing new entry requests
if you want use a cache library to cache bots instance for evry user
for example you can use laravel cache to cache all bots by usernames/passwords
$done = false;
do{
$value = Cache::get($email .'-'. $password, function () {
$bot->auth->login($email, $password);
if($bot->auth->isLoggedIn())
{
if (!$bot->user->isBanned()) {
return $bot; // connected
}
}
return null; // not connected
});
if($value)
{
try {
$value->pins->dosomethng();
$done = true; //stop the while
}catch (\Exception $e) {
echo ' > [ERROR] ' . $e->getMessage();
/// check errors by case
//// check if the user is login and cookies still a live an east way is forget this username bot instance from the cache to login again and try to do the same thing
cache::forget($email .'-'. $password);
/// other errors check
}
} else {
break; /// user banned or login fail
}
} while (!$done);
Currently as far as I know, cookie storage is only at temp or at specific folder for only ONE user. How can I store more than one users' cookies in folder or database?
Bot's current approach is:
Search cookie in temp for current username, if exist continue, if not exist do login request.
Can someone show multi user login structure?
For example I have 100 Pinterest accounts info in my db, how can I use and hold these 100 accounts' cookie info without http request for new login to Pinterest. Because I have already cookies.