This PHP library will help you to work with your Pinterest account without using any API account credentials.

Overview

Pinterest Bot for PHP

Pinterest PHP Bot

Build Status Code Climate Scrutinizer Code Quality Test Coverage StyleCI Total Downloads

A PHP library to help you work with your Pinterest account without API credentials.

The Pinterest API is painful: receiving an access token involves registering a developer account, registering an application, then waiting for confirmation. Not to mention, the public API itself is poorly implemented and has a limited set of features.

This library offers the full functionality available on Pinterest's website, with no need to register an application to receive an access token. All that's needed is your account login information (but even this is not required if you don't plan on creating pins, writing comments or sending messages)!

Installation

Dependencies

Library requires CURL extension and PHP 7.0 or above.

The recommended way to install this library is via Composer. New to Composer?

composer require seregazhuk/pinterest-bot

Quick Start

// You may need to amend this path to locate Composer's autoloader
require('vendor/autoload.php'); 

use seregazhuk\PinterestBot\Factories\PinterestBot;

$bot = PinterestBot::create();

// Login
$bot->auth->login('mypinterestlogin', 'mypinterestpassword');

// Get lists of your boards
$boards = $bot->boards->forUser('yourUserName');

// Create a pin
$bot->pins->create('http://exmaple.com/image.jpg', $boards[0]['id'], 'Pin description');

Note: Some methods (e.g. get user followers/following, pins likes/dislikes, search and other feed queries) use Pinterest navigation through results (with bookmarks). This means that for every batch of results, a call is made to Pinterest and a Pagination object with Pinterest API results is returned.

How to avoid ban

To avoid being banned by Pinterest, do not aggressively pin or write comments (e.g. creating hundreds of pins in a single minute). Do this by inserting timeouts (sleep($seconds)) with calls.

Examples

These articles provide examples of common tasks that can be performed with the bot:

How can I thank you?

Why not star this GitHub repo? I'd love the attention! Or, you can donate to my project on PayPal:

Support me with some coffee

Thanks!

Comments
  • Request: add the feauture: Edit pin

    Request: add the feauture: Edit pin

    Hi, I wonder if I can make a request here. Can you please support the feature Edit pin for this Bot. The input will be the pinID and other necessary infos to update for that pin. something like:

    public function editPin($pinID, $description = "new Description", $link = "new Link")

    Thanks in advance,

    opened by peterqtr11 38
  • Login method not working

    Login method not working

    Same as reported by someone else.

    Login method doesn't seem to work, error message when calling the isBanned method. Fatal error: Uncaught seregazhuk\PinterestBot\Exceptions\AuthRequired: Error calling seregazhuk\PinterestBot\Api\Providers\User::isBanned method. You must log in before

    Tried: var_dump($bot->getLastError()); output NULL

    Tried the credentials in the browser, working fine there. Account not blocked etc.

    help wanted 
    opened by derkleinemukk 29
  • Login Failed,

    Login Failed,

    I've tried to use pins create method and I got following error:

    AuthException in ProviderLoginCheckWrapper.php line 54: You must log in before.

    Yes I have used login function before calling this method and I get return true (as I assume its successfully logged in).

    Currently I am using XAMPP

    opened by capripio 29
  • Not working after update.

    Not working after update.

    I update but not working. I get this error message on log. I am sure in username and pass.

    [19-Feb-2019 21:29:34 Europe/Minsk] PHP Fatal error: Uncaught seregazhuk\PinterestBot\Exceptions\AuthRequired: Error calling seregazhuk\PinterestBot\Api\Providers\Pins::create method. You must log in before. in /vendor/seregazhuk/pinterest-bot/src/Api/Providers/Core/ProviderWrapper.php:66 Stack trace: #0 /vendor/seregazhuk/pinterest-bot/src/Api/Providers/Core/ProviderWrapper.php(42): seregazhuk\PinterestBot\Api\Providers\Core\ProviderWrapper->checkMethodForLoginRequired('create') #1 /deneme.php(28): seregazhuk\PinterestBot\Api\Providers\Core\ProviderWrapper->__call('create', Array) #2 {main} thrown in /vendor/seregazhuk/pinterest-bot/src/Api/Providers/Core/ProviderWrapper.php on line 66

    opened by murattikil 16
  • Unable to see Comments array data in Pin array

    Unable to see Comments array data in Pin array

    I was able to see the comments array in pins array, but it seems it isn't displayed anymore.

    
    Array
    
    (
         [bookmark] => LT42OTM4Mzg1NjYzNzE4OTA4ODo1fDIxNzNhNzViMWEzNDhmMGIwN2RhNTRhMjU2YjcwODJjZTVkYzdiYWFmNzcyMjE2Zjg5NGMzOTVhNDZjMzAyOGM=
        [data] => Array
             (
             )
    
         [uri] => /v3/pins/69383650488493124/comments/
     )
    
    bug question 
    opened by ltiwana 15
  • Get a list of sections for a specified boardId not working

    Get a list of sections for a specified boardId not working

    Hi

    Running: $sections = $bot->boardSections->forBoard($boardId);

    returns this error: _Fatal error: Uncaught seregazhuk\PinterestBot\Exceptions\WrongProvider: Provider seregazhuk\PinterestBot\Api\Providers\Boardsections not found. in /mypath/vendor/seregazhuk/pinterest-bot/src/Api/ProvidersContainer.php:191 Stack trace: #0 /mypath/vendor/seregazhuk/pinterest-bot/src/Api/ProvidersContainer.php(119): seregazhuk\PinterestBot\Api\ProvidersContainer->resolveProviderClass('boardsections') #1 /mypath/vendor/seregazhuk/pinterest-bot/src/Api/ProvidersContainer.php(104): seregazhuk\PinterestBot\Api\ProvidersContainer->addProvider('boardsections') #2 /mypath/vendor/seregazhuk/pinterest-bot/src/Api/ProvidersContainer.php(82): seregazhuk\PinterestBot\Api\ProvidersContainer->getProvider('boardsections') #3 /mypath/test_section.php(30): seregazhuk\PinterestBot\Api\ProvidersContainer->_get('boardSections') #4 {main} thrown in /mypath/vendor/seregazhuk/pinterest-bot/src/Api/ProvidersContainer.php on line 191

    Could you please have a look at this?

    help wanted question 
    opened by delemore 14
  • problem getting boards from account

    problem getting boards from account

    there is one profile that the bot cannot get the boards from and I noticed it's one that was apparently upgraded to a business account. Is there an issue getting boards from business accounts or any other type of account? All my other accounts will list the boards fine but this one comes up with empty array every time.

    I've tried both of these calls:

    $boards = $bot->boards->forMe(); $boards = $bot->boards->forUser($me_username);

    both are the same - empty array. And I have six boards full of pins on that account running for about six years now

    all my other accounts are pulling the boards just fine, it's only this one account that just does not pull the boards from.

    By the way, I discovered that I can pull the boards from this account using the official API but not with the bot

    any thoughts? thanks in advance :) h.

    opened by hhitch 11
  • Comment function not working for me

    Comment function not working for me

    Hey there,

    first of all thank you for your great pinterest php api. I used your comment example to comment on a pin, but nothing happens. Is this function buggy?

    Thank you so far

    help wanted 
    opened by newschooler 11
  • Observing the PhP Fatal Error again with the v5.9.1

    Observing the PhP Fatal Error again with the v5.9.1

    Hi all,

    I started to observe following error with the v5.9.1, same issue solved with 5.9.1.

    Anyone else ?

    PHP Fatal error: Uncaught seregazhuk\PinterestBot\Exceptions\AuthRequired: Error calling seregazhuk\PinterestBot\Api\Providers\User::isBanned method. You must log in before. in /home/composer/vendor/seregazhuk/pinterest-bot/src/Api/Providers/Core/ProviderWrapper.php:66 Stack trace: #0 /home/composer/vendor/seregazhuk/pinterest-bot/src/Api/Providers/Core/ProviderWrapper.php(42): seregazhuk\PinterestBot\Api\Providers\Core\ProviderWrapper->checkMethodForLoginRequired('isBanned') #1 /home/composer/vendor/auto_pins_values.php(22): seregazhuk\PinterestBot\Api\Providers\Core\ProviderWrapper->__call('isBanned', Array) #2 {main}

    Expected behavior A clear and concise description of what you expected to happen.

    Screenshots If applicable, add screenshots to help explain your problem.

    Desktop (please complete the following information):

    • OS: [e.g. iOS]
    • Browser [e.g. chrome, safari]
    • Version [e.g. 22]

    Smartphone (please complete the following information):

    • Device: [e.g. iPhone6]
    • OS: [e.g. iOS8.1]
    • Browser [e.g. stock browser, safari]
    • Version [e.g. 22]

    Additional context Add any other context about the problem here.

    opened by gonjumixproject 9
  • People Search .....pinners->search('query')

    People Search .....pinners->search('query')

    Hi Seregazhuk, Just noticed that the pinners/search query is returning an error. I am using version 557 of the library. For Example: $bot->pinners->search('cats',10)->toArray(); previously gave the expected result. It now gives an array which looks like this: Array ( [0] => [1] => [2] => Array ( )

    [3] => 
    [4] => 
    [5] => 
    [6] => Array
        (
        )
    
    [7] => 
    [8] => 
    [9] => 
    [10] => 
    [11] => 
    [12] => 
    [13] => 
    

    )

    If I do a foreach on a pagination object, the result is blank. Wondering what I m doing wrong, since this query used to work fine... Cheers, Maurie

    opened by MaurieF 9
  • boards->forUser() Not returning secret boards.

    boards->forUser() Not returning secret boards.

    I have a staging pinterest account (non-business) with 2 public boards, 2 secret boards. On staging, boards->forUser() will successfully grab all 4 boards. On my business Pinterest account, I have 88 public boards and 4 secret boards. Using boards->forUser('userHere',100) with this business account only fetches 88 of the 92 boards. Not sure if the difference in number of boards or difference in type of account (normal vs business) is causing the change in behavior.

    opened by zjzeit 9
  • Login method not working

    Login method not working

    my previously running codes are not working #442

    I encountered an issue with the following code:

    php use seregazhuk\PinterestBot\Factories\PinterestBot; $bot = PinterestBot::create(); $bot->auth->login($UserMail, $UserPassword);

    if ($bot->user->isBanned()) {
    	echo "Account has been banned!\n";
    	die();
    }
    

    Library version: v5.9.1 PHP version: 7.3.11 I'm getting an error

    Fatal error: Uncaught seregazhuk\PinterestBot\Exceptions\AuthRequired: Error calling seregazhuk\PinterestBot\Api\Providers\User::isBanned method. You must log in before. in C:\xampp\htdocs\sil\vendor\seregazhuk\pinterest-bot\src\Api\Providers\Core\ProviderWrapper.php:66 Stack trace: #0 C:\xampp\htdocs\sil\vendor\seregazhuk\pinterest-bot\src\Api\Providers\Core\ProviderWrapper.php(42): seregazhuk\PinterestBot\Api\Providers\Core\ProviderWrapper->checkMethodForLoginRequired('isBanned') #1 C:\xampp\htdocs\sil\pin.php(19): seregazhuk\PinterestBot\Api\Providers\Core\ProviderWrapper->__call('isBanned', Array) #2 {main} thrown in C:\xampp\htdocs\sil\vendor\seregazhuk\pinterest-bot\src\Api\Providers\Core\ProviderWrapper.php on line 66

    Thanks for your help

    opened by policemal 9
  • Autoloader issue

    Autoloader issue

    Hi, firstly thank you all for your contribution. I am sorry for this noob-question by this is my first coding project. Below is the problem I am having.

    I encountered an issue:

    [Sat Nov 28 14:43:43 2020] PHP Warning: require(vendor/autoload.php): failed to open stream: No such file or directory in C:\MyProjects\PHP\php-pinterest-bot-master\0.Projects\PinInfo.php on line 3 [Sat Nov 28 14:43:43 2020] PHP Fatal error: require(): Failed opening required 'vendor/autoload.php' (include_path='.;C:\php\pear') in C:\MyProjects\PHP\php-pinterest-bot-master\0.Projects\PinInfo.php on line 3

    When running this code:

    <?php
    
    require __DIR__ . '/vendor/autoload.php';
    
    use seregazhuk\PinterestBot\Factories\PinterestBot;
    
    $bot = PinterestBot::create();
    $bot->auth->login('xxxxxxx', 'yyyyyy');
    
    $info = $bot->pins->info(11111111111111);
    
    ?>
    

    File vendor/autoload.php:

    <?php
    
    // autoload.php @generated by Composer
    
    require_once __DIR__ . '/composer/autoload_real.php';
    
    return ComposerAutoloaderInita11111111111111111::getLoader();`
    

    Library version: When running: C:\MyProjects\PHP\php-pinterest-bot-master>composer show seregazhuk/php-pinterest-bot

    I get this:

    [InvalidArgumentException] Package seregazhuk/php-pinterest-bot not found

    However when installing composer C:\MyProjects\PHP\php-pinterest-bot-master>composer install

    I get this:

    Installing dependencies from lock file (including require-dev) Verifying lock file contents can be installed on current platform. Nothing to install, update or remove Package guzzle/guzzle is abandoned, you should avoid using it. Use guzzlehttp/guzzle instead. Package padraic/phar-updater is abandoned, you should avoid using it. No replacement was suggested. Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested. Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested. Package satooshi/php-coveralls is abandoned, you should avoid using it. Use php-coveralls/php-coveralls instead. Generating autoload files 14 packages you are using are looking for funding. Use the composer fund command to find out more!

    C:\MyProjects\PHP\php-pinterest-bot-master>composer fund

    The following packages were found in your dependencies which publish funding information:

    composer ca-bundle https://packagist.com https://github.com/sponsors/composer https://tidelift.com/funding/github/packagist/composer/composer

    doctrine instantiator https://www.doctrine-project.org/sponsorship.html https://www.patreon.com/phpdoctrine https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator

    myclabs deep-copy https://tidelift.com/funding/github/packagist/myclabs/deep-copy

    phpunit php-code-coverage, php-file-iterator, php-text-template, php-timer, php-token-stream, phpunit https://github.com/sponsors/sebastianbergmann phpunit https://phpunit.de/donate.html

    sebastian code-unit-reverse-lookup, comparator, diff, environment, exporter, global-state, object-enumerator, object-reflector, recursion-context, resource-operations, version https://github.com/sponsors/sebastianbergmann

    symfony config, console, debug, event-dispatcher, filesystem, polyfill-ctype, polyfill-mbstring, polyfill-php80, service-contracts, stopwatch, yaml https://symfony.com/sponsor https://github.com/sponsors/fabpot https://tidelift.com/funding/github/packagist/symfony/symfony

    theseer tokenizer https://github.com/sponsors/theseer

    PHP version: 7.4.12 Thanks.

    opened by balubalubalu 0
  • Your requirements could not be resolved to an installable set of packages.

    Your requirements could not be resolved to an installable set of packages.

    I'm getting this error while installing this package Your requirements could not be resolved to an installable set of packages.

    Problem 1 - The requested package php-http/guzzle6-adapter (locked at v1.1.1, required as ^2.0) is satisfiable by php-http/guzzle6-adapter[v1.1.1] but these conflict with your requirements or minimum-stability. Problem 2 - league/omnipay v3.0.0 requires php-http/guzzle6-adapter ^1.1 -> satisfiable by php-http/guzzle6-adapter[v1.1.0, v1.1.1] but these conflict with your requirements or minimum-stability. - league/omnipay v3.0.0 requires php-http/guzzle6-adapter ^1.1 -> satisfiable by php-http/guzzle6-adapter[v1.1.0, v1.1.1] but these conflict with your requirements or minimum-stability. - league/omnipay v3.0.0 requires php-http/guzzle6-adapter ^1.1 -> satisfiable by php-http/guzzle6-adapter[v1.1.0, v1.1.1] but these conflict with your requirements or minimum-stability. - Installation request for league/omnipay 3 -> satisfiable by league/omnipay[v3.0.0].

    Installation failed, reverting ./composer.json to its original content.

    This is my composer.json { "name": "laravel/laravel", "type": "project", "description": "The Laravel Framework.", "keywords": [ "framework", "laravel" ], "license": "MIT", "require": { "php": "^7.2.5", "fideloper/proxy": "^4.2", "fruitcake/laravel-cors": "^2.0", "guzzlehttp/guzzle": "^6.3", "laravel/framework": "^7.24", "laravel/tinker": "^2.0", "laravel/ui": "^2.2", "mahdimajidzadeh/laravel-unsplash": "^0.1.4", "seregazhuk/pinterest-bot": "^5.9", "waleedahmad/pinterest-laravel": "^1.0" }, "require-dev": { "facade/ignition": "^2.0", "fzaninotto/faker": "^1.9.1", "mockery/mockery": "^1.3.1", "nunomaduro/collision": "^4.1", "phpunit/phpunit": "^8.5" }, "config": { "optimize-autoloader": true, "preferred-install": "dist", "sort-packages": true }, "extra": { "laravel": { "dont-discover": [] } }, "autoload": { "psr-4": { "App\": "app/" }, "classmap": [ "database/seeds", "database/factories" ] }, "autoload-dev": { "psr-4": { "Tests\": "tests/" } }, "minimum-stability": "dev", "prefer-stable": true, "scripts": { "post-autoload-dump": [ "Illuminate\Foundation\ComposerScripts::postAutoloadDump", "@php artisan package:discover --ansi" ], "post-root-package-install": [ "@php -r "file_exists('.env') || copy('.env.example', '.env');"" ], "post-create-project-cmd": [ "@php artisan key:generate --ansi" ] } }

    opened by AJMALSARIM 0
  • Can you please help me to use the edit command ?

    Can you please help me to use the edit command ?

    Hi all,

    I am trying to edit the pins inside of a specific board, however my script partially works..

    Sometimes it edits 10 pins, sometimes it edits 1 pin. It does not edit repins at all...

    Can you please help me on this ?

    if($_POST){ $newLink = $_POST['link']; $board = $boards[$_POST['board']];

    $boardId = $board['id'];
    $boardPinCount = $board['pin_count'];
    
    $pins = Array();
    
    foreach ($bot->boards->pins($boardId, $boardPinCount) as $pin) {
    array_push($pins, $pin);
    }
    foreach ($pins as $pin) {
    	$desc = $pin['description'];
    	$link = $newLink;
    	$bot->pins->edit($pin['id'], $desc, $link);
    	echo $pin['id'];
    	echo '<br>';
    	echo $pin['description'];
    	echo '<br>';
    
    }
    

    Thank you..

    opened by gonjumixproject 0
  • Get Boards Return Empty

    Get Boards Return Empty

    Hi, I have problem while retreiving boards. Last time it works fine but suddenly just got empty board list. So, I cannot get board Id to post it.

    I do into this following way

    $bot = PinterestBot::create();
    $result = $bot->auth->login($account['email'], $account['password']);
    // add proxy
    if(ISSET($account['proxyId'])) {
    	$bot->getHttpClient()->useProxy($ip, $port);
    }
    if ($bot->user->isBanned()) {
    	return array('status'=>'failed','notification'=>'Banned');
    }
    if (!$result) {
    	return array('status'=>'failed','notification'=>'Login failed');
    }
    $boards = $bot->boards->forUser($account['username']); //got empty result
    

    I tried to var_dump and here is the result array(0) { }

    opened by flameblue59 0
Releases(v5.9.1)
Owner
Sergey Zhuk
Sergey Zhuk
Laravel api tool kit is a set of tools that will help you to build a fast and well-organized API using laravel best practices.

Laravel API tool kit and best API practices Laravel api tool kit is a set of tools that will help you to build a fast and well-organized API using lar

Ahmed Esa 106 Nov 22, 2022
CherryStar is a compilation of technologies that you must know to work as back-end or front-end developer.

CherryStar - Study case, starting with recent technologies CherryStar is a compilation of technologies that you must know to work as back-end or front

Renan R. Murussi 8 Sep 8, 2022
A PHP SDK for the ScreenshotOne.com API to take screenshots of any URL

phpsdk An official Screenshot API client for PHP. It takes minutes to start taking screenshots. Just sign up to get access and secret keys, import the

ScreenshotOne.com 4 Jun 14, 2022
Simple and effective multi-format Web API Server to host your PHP API as Pragmatic REST and / or RESTful API

Luracast Restler ![Gitter](https://badges.gitter.im/Join Chat.svg) Version 3.0 Release Candidate 5 Restler is a simple and effective multi-format Web

Luracast 1.4k Dec 14, 2022
This small POC aims to show how Symfony is able, natively without modifications, to use subdirectories for Entities, Repositories, controllers, views…

POC - Using Sub Directories in a Symfony Project This small POC aims to show how Symfony is able, natively without modifications, to use subdirectorie

Yoan Bernabeu 2 May 12, 2022
Disable Google's FLoC with help of PSR-15 middleware

Disable Google's FLoC with PSR-15 middleware This package will help you disable Google's FLoC. Installation You can install the package via composer:

P7V 9 Dec 14, 2022
微信支付 API v3 的 PHP Library,同时也支持 API v2

微信支付 WeChatPay OpenAPI SDK [A]Sync Chainable WeChatPay v2&v3's OpenAPI SDK for PHP 概览 微信支付 APIv2&APIv3 的Guzzle HttpClient封装组合, APIv2已内置请求数据签名及XML转换器,应

null 275 Jan 5, 2023
A simple way of authenticating your RESTful APIs with API keys using Laravel

ApiGuard This package is no longer maintained This package is no longer maintained as Laravel already has a similar feature built-in since Laravel 5.8

Chris Bautista 691 Nov 29, 2022
Using waifu2x api from DeepAI - ye UPSCALE YOUR WAIFUUUU

php-waifu2x-api Using waifu2x api from DeepAI - ye UPSCALE YOUR WAIFUUUU Usage You must fill your api key from DeepAI $API_KEY = "YOUR_API_KEY_HEREEEE

michio 2 Sep 21, 2021
The 1Password Connect PHP SDK provides your PHP applications access to the 1Password Connect API hosted on your infrastructure and leverage the power of 1Password Secrets Automation

1Password Connect PHP SDK The 1Password Connect PHP SDK provides your PHP applications access to the 1Password Connect API hosted on your infrastructu

Michelangelo van Dam 12 Dec 26, 2022
Platform to get informations about any country.

OpenCountries This project is a web platform developped in PHP implementing the RestCountries API. The objective of the project is to get informations

null 3 May 2, 2022
Laravel library to convert your models into API responses.

Laravel Scene Laravel library to convert your models into API responses. Why a transformation library? By default you can use the default implementati

Ahmed Azaan 27 Nov 23, 2022
This plugin lets you to get spawners that when you break them they regenerates themselves!

ItemSpawners This plugin lets you to get spawners that when you break them they regenerates themselves! How to use? For any information: https://githu

Oğuzhan 6 Jan 16, 2022
API for Symbiota using the Lumen PHP PHP Micro-Framework By Laravel

symbiota-api API for Symbiota using the Lumen PHP PHP Micro-Framework By Laravel Laravel Lumen Official Documentation Documentation for the Lumen fram

Biodiversity Knowledge Integration Center 2 Jan 3, 2022
Facebook SDK for PHP (v6) - allows you to access the Facebook Platform from your PHP app

Facebook SDK for PHP (v6) This repository contains the open source PHP SDK that allows you to access the Facebook Platform from your PHP app. Installa

null 0 Aug 10, 2022
A simple object-relational mapping library built using PHP.

A simple object-relational mapping library built using PHP.

Maleesha Gimshan 2 Jun 29, 2021
PHP library/SDK for Crypto APIs 2.0 using Guzzle version 7

cryptoapis/sdk-guzzle7 Crypto APIs 2.0 is a complex and innovative infrastructure layer that radically simplifies the development of any Blockchain an

Crypto APIs 3 Oct 21, 2022
A Laravel Fractal package for building API responses, giving you the power of Fractal with Laravel's elegancy.

Laravel Responder is a package for building API responses, integrating Fractal into Laravel and Lumen. It can transform your data using transformers,

Alexander Tømmerås 776 Dec 25, 2022
Laravel A2Reviews Client API lets you build apps, extensions, or plugins to get reviews from the A2reviews APP.

Overview Laravel A2Reviews Client API lets you build apps, extensions or plugins to get reviews from the A2reviews APP. Including adding reviews to a

Be Duc Tai 2 Sep 26, 2021