Skip to content

Instantly share code, notes, and snippets.

@CanRau
Last active October 23, 2017 04:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CanRau/9f70d68066983e669167 to your computer and use it in GitHub Desktop.
Save CanRau/9f70d68066983e669167 to your computer and use it in GitHub Desktop.
Get Pinterest full size images
$json = file_get_contents('https://api.pinterest.com/v3/pidgets/boards/Globetrawter/natural-homes/pins/');
$jsonIterator = new RecursiveIteratorIterator(
new RecursiveArrayIterator(json_decode($json, TRUE)),
RecursiveIteratorIterator::SELF_FIRST);
foreach ($jsonIterator as $key) {
// get only url you can var_dump($key) and see what you like ;-)
if(isset($key['url']) && strpos($key['url'], '.jpg') !== false) {
$pin = str_replace('237x', '736x', $key['url']);
// put them in Processwire images field..you can of course do whatever you whant :D
$page->of(false);
$page->images = $pin;
$page->save('images');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment