<?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>";
  }
?>