Pinterest bot protection

I don’t think we 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
  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>";

?>
© 2012-2016 NextScripts.com