PHP code example of dirkgroenen / pinterest-api-php
1. Go to this page and download the library: Download dirkgroenen/pinterest-api-php library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
dirkgroenen / pinterest-api-php example snippets
use DirkGroenen\Pinterest\Pinterest;
$pinterest = new Pinterest(CLIENT_ID, CLIENT_SECRET);
$loginurl = $pinterest->auth->getLoginUrl(CALLBACK_URL, array('read_public'));
echo '<a href=' . $loginurl . '>Authorize Pinterest</a>';
if(isset($_GET["code"])){
$token = $pinterest->auth->getOAuthToken($_GET["code"]);
$pinterest->auth->setOAuthToken($token->access_token);
}
$me = $pinterest->users->me();
echo $me;
$pinterest->users->me();
$pinterest->users->me(array(
'fields' => 'username,first_name,last_name,image[small,large]'
));
$pins = $pinterest->users->getMeLikes();
$pins->all();
$pins = $pinterest->users->getMeLikes();
$pins->get(0);
$pins = $pinterest->users->getMeLikes();
$pins->hasNextPage();
$pins = $pinterest->users->getMeLikes();
$pins->pagination['cursor'];
$pinterest->auth->getLoginUrl("https://pinterest.dev/callback.php", array("read_public"));
$pinterest->auth->getOAuthToken($code);
$pinterest->auth->setOAuthToken($access_token);
$pinterest->auth->getState();
$pinterest->auth->setState($state);
$pinterest->getRateLimit();
$pinterest->getRateLimitRemaining();
$pinterest->users->me();
$pinterest->users->find('dirkgroenen');
$pinterest->users->getMePins();
$pinterest->users->searchMePins("cats");
$pinterest->users->searchMeBoards("cats");
$pinterest->users->getMeBoards();
$pinterest->users->getMeLikes();
$pinterest->users->getMeFollowers();
$pinterest->boards->get("dirkgroenen/pinterest-api-test");
$pinterest->boards->create(array(
"name" => "Test board from API",
"description" => "Test Board From API Test"
));
$pinterest->boards-edit("dirkgroenen/pinterest-api-test", array(
"name" => "Test board after edit"
));
$pinterest->boards->delete("dirkgroenen/pinterest-api-test");
$pinterest->sections->create("503066289565421205", array(
"title" => "Test from API"
));
$pinterest->sections->get("503066289565421205");
$pinterest->sections->pins("5027630990032422748");
$pinterest->sections->delete("5027630990032422748");
$pinterest->pins->get("181692166190246650");
$pinterest->pins->fromBoard("dirkgroenen/pinterest-api-test");
$pinterest->pins->create(array(
"note" => "Test board from API",
"image_url" => "https://download.unsplash.com/photo-1438216983993-cdcd7dea84ce",
"board" => "dirkgroenen/pinterest-api-test"
));
$pinterest->pins->create(array(
"note" => "Test board from API",
"image" => "/path/to/image.png",
"board" => "dirkgroenen/pinterest-api-test"
));
$pinterest->pins->create(array(
"note" => "Test board from API",
"image_base64" => "[base64 encoded image]",
"board" => "dirkgroenen/pinterest-api-test"
));
$pinterest->pins->edit("181692166190246650", array(
"note" => "Updated name"
));
$pinterest->pins->delete("181692166190246650");
$pinterest->following->users();
$pinterest->following->boards();
$pinterest->following->interests();
$pinterest->following->followUser("dirkgroenen");
$pinterest->following->unfollowUser("dirkgroenen");
$pinterest->following->followBoard("503066289565421201");
$pinterest->following->unfollowBoard("503066289565421201");
$pinterest->following->followInterest("architecten-911112299766");
$pinterest->following->unfollowInterest("architecten-911112299766");
composer