DEPRECATED AND NO LONGER MAINTAINED, however, as of 2017-03-01, this library still works.
Please see the official Pinterest API.
Pinterest API is not released yet, so there is no way to programmatically create a pin. So here is this class for - Autoposter, Autopinner, whatever you like to call it.
This is an unofficial API, and likely to change and break at any moment.
PinterestPinner is not a way to avoid any Pinterest terms, conditions, rules and regulations. Please use the class in accordance with all Pinterest rules. If you abuse the service you will be banned there.
Please follow the PSR-2 coding standards if you would like to create a pull request.
You can easily install PinterestPinner with the following command:
composer require dzafel/pinterest-pinner:2.*
or alternatively, include a dependency for dzafel/pinterest-pinner
in your composer.json
file. For example:
{
"require": {
"dzafel/pinterest-pinner": "2.*"
}
}
To add a new pin:
try {
$pinterest = new \PinterestPinner\Pinner;
$pin_id = $pinterest->setLogin('Your Pinterest Login')
->setPassword('Your Pinterest Password')
->setBoardID('Pinterest Board ID')
->setImage('Image URL')
->setDescription('Pin Description')
->setLink('Pin Link')
->pin();
} catch (\PinterestPinner\PinnerException $e) {
echo $e->getMessage();
}
You can also get additional info:
// Get a list of boards
$boards = $pinterest->getBoards();
// Get a list of pins
$pins = $pinterest->getPins();
// Get logged in user data
$user = $pinterest->getUserData();
- FIX:
composer.json
version fix
- FIX:
getUserData()
should load the user details fromtree > data
array path instead ofresourceDataCache
(#21)
- Added Guzzle 6 support (required:
>=5.0
)
- FIX:
_responseToArray()
now search for config JSON in<script id="jsInit1">
instead ofP.main.start()
function (#17)
- FIX: new
getBoards()
logic, now it returns all boards instead of just first 50 (#16)
- FIX: typo in init function -
P.start.start
instead ofP.main.start
(#15) - FIX:
getBoards()
always returned empty array, becausegetPins()
returned pins collection, not full response json (#15)
- FIX: init function name changed from
P.scout.init
toP.main.start
(#14) - FIX: do
preg_match()
only if response value is a string - NEW: added public
$user_data
variable - NEW: changed some private methods and vars to protected so class can be extended
- NEW: Library is now composer friendly
- NEW: Added Guzzle dependency
- FIX: reload CSRF token upon login
- Initial release