Last active
October 23, 2017 04:49
-
-
Save CanRau/9f70d68066983e669167 to your computer and use it in GitHub Desktop.
Get Pinterest full size images
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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