NextScripts Pinterest API library for PHP

NextScripts Autoposting API for Pinterest allows you to pin your images to your Pinterest boards.

Social image-sharing site Pinterest is growing fast. Your site or blog is already posting your updates to Facebook and Twitter, so what about Pinterest?
Pinterest API is not released yet, so there were no way to sync your updates around all networks including this one.

We did it with Google Plus, and now we did it with Pinterest as well. New Automated Posting API library from “NextScripts” is capable of automatic sharing images from your site directly to your Pinterest boards.

Pinterest Automated Posting Demo

Please enter some text, select an image and click “Post” button.

Select Image to be Posted:

GPGPPNPNPN
  Post   it to our NextScripts Pinterest Demo Account

How to use it – Let’s see some code:

Pin an image to your Pinterest board:
[php] <?php
require_once “nxs-api/nxs-api.php”;
require_once “nxs-api/nxs-http.php”;
require_once “inc/nxs-functions.php”;

$email = ‘YourEmail@gmail.com’;
$pass = ‘YourPassword’;
$msg = ‘Post this to Pinterest!’;
$imgURL = ‘http://www.YourWebsiteURL.com/link/to/your/image.jpg’;
$link = ‘http://www.YourWebsiteURL.com/page’;
$boardID = ‘104935301886129712427’;

$nt = new nxsAPI_PN();
$loginError = $nt->connect($email, $pass);
if (!$loginError)
{
$result = $nt -> post($msg, $imgURL, $link, $boardID);
}
else echo $loginError;

if (!empty($result) && is_array($result) && !empty($result[‘post_url’]))
echo ‘<a target=”_blank” href=”‘.$result[‘post_url’].'”>New Post</a>’;
else
echo “<pre>”.print_r($result, true).”</pre>”;
?>
[/php]

We don’t need to remind you, but NextScripts API is not a way to avoid any Pinterest terms, conditions, rules and regulations. Please use API in accordance with all Pinterest rules. If you abuse the service (with or without API) you will be banned there.

Pinterest detects bots by checking for often logins. If you make Pinterest posts quite often, you need to avoid using $nt->connect function every time. API stores login info in the public variable called ck ($nt->ck). You need to save this variable somewhere and then use it for future posts.
[php] <?php
require_once “nxs-api/nxs-api.php”;
require_once “nxs-api/nxs-http.php”;
require_once “inc/nxs-functions.php”;

$nxs_gCookiesArr = getSavedPinterestLogin(); // Use your function to retrieve saved data to array

$email = ‘YourEmail@gmail.com’;
$pass = ‘YourPassword’;
$msg = ‘Post this to Pinterest!’;
$imgURL = ‘http://www.YourWebsiteURL.com/link/to/your/image.jpg’;
$link = ‘http://www.YourWebsiteURL.com/page’;
$boardID = ‘104935301886129712427’;

$nt = new nxsAPI_PN(); $nt->ck = $nxs_gCookiesArr;
$loginError = $nt->connect($email, $pass);
if (!$loginError)
{
// Use your function to save array data
savePinterestLogin($nt->ck);
$result = $nt -> post($msg, $imgURL, $link, $boardID);
}
else echo $loginError;

if (!empty($result) && is_array($result) && !empty($result[‘post_url’]))
echo ‘<a target=”_blank” href=”‘.$result[‘post_url’].'”>New Post</a>’;
else
echo “<pre>”.print_r($result, true).”</pre>”;

?>
[/php]

Get SNAP API

Google+ Automated Posting Script is now part of the universal SNAP API. SNAP API provides a universal API interface for autoposting to more then 25 different social networks including Google+, Pinterest, Flipboard, Reddit, YouTube, Blogger, and LinkedIn Company Pages as well as Facebook, Twitter, Tumblr, Flickr, Scoop.It and many others

More infoGet it

Posts made by SNAP

Please see more code samples and documentation

Requirements

PHP Ver > 5.2 (PHP 7 or 7.1 is recommended)
PHP should have at least 32M of memory (64M and more is highly recommended).
curlSSL
gzip and mbstring are not required but will make things work faster.

Get SNAP Now

SNAP Plugin for WordPress is free to install and use.