I created a simple tool that collects pinterest pins and boards just by typing in a pinterest user name. It uses a modified API I found at http://pinterestapi.co.uk. The drawback to this API is that it limits to 50 records. Until pinterest gets their act together and provides a full API, the best we can do is scrape the site. I also have some PHP code that can be used to scrape for boards.


$target_url = “http://www.pinterest.com/hersheycompany”;
$userAgent = ‘ScraperBot’;
$qw = curl_init();
curl_setopt($qw, CURLOPT_USERAGENT, $userAgent);
curl_setopt($qw, CURLOPT_URL,$target_url);
curl_setopt($qw, CURLOPT_FAILONERROR, true);
curl_setopt($qw, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($qw, CURLOPT_AUTOREFERER, true);
curl_setopt($qw, CURLOPT_RETURNTRANSFER,true);
curl_setopt($qw, CURLOPT_TIMEOUT, 20);

$html= curl_exec($qw);
if (!$html)
echo “ERROR NUMBER: “.curl_errno($ch);
echo “ERROR: “.curl_error($ch);

$dom = new DOMDocument();

$xpath = new DOMXPath($dom);
$href = $xpath->evaluate(“/html/body//h3/a”);

for ($i = 0; $i < $href->length; $i++) {
$data = $href->item($i);
$url = $data->getAttribute(‘href’);
echo $url . “<br>”;