SkullandBones Posted November 15, 2013 Share Posted November 15, 2013 How do I fetch a webpages thumbnails and the links that they point to and print it out onto one of my web pages? I'm trying to get thumbnails from imgurs gallery. I used this code so far but it just gives me the whole page and the links that the thumbnails point to dont work. <?php // URLs we want to retrieve $urls = array( 'http://imgur.com/gallery' ); // initialize the multihandler $mh = curl_multi_init(); $channels = array(); foreach ($urls as $key => $url) { // initiate individual channel $channels[$key] = curl_init(); curl_setopt_array($channels[$key], array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true )); // add channel to multihandler curl_multi_add_handle($mh, $channels[$key]); } // execute - if there is an active connection then keep looping $active = null; do { $status = curl_multi_exec($mh, $active); } while ($active && $status == CURLM_OK); // echo the content, remove the handlers, then close them foreach ($channels as $chan) { echo curl_multi_getcontent($chan); curl_multi_remove_handle($mh, $chan); curl_close($chan); } // close the multihandler curl_multi_close($mh); ?> Thanks for any help. Link to comment https://forums.phpfreaks.com/topic/283907-fetch-image-thumbnails-and-links-from-site/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.