Created
July 1, 2014 13:53
-
-
Save francolaiuppa/d97096bf7be37a3455ee to your computer and use it in GitHub Desktop.
Droplr Scrapper
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
<?php | |
function droplr($droplrUrl = 'http://d.pr/i/YBbX') { | |
$data = file_get_contents($droplrUrl); | |
$result = array(); | |
$dom = new DOMDocument; | |
$dom->loadHTML($data); | |
foreach ($dom->getElementsByTagName('img') as $node) { | |
$result[] = $dom->saveHtml($node); | |
} | |
$scrapedImage = array_pop($result); | |
$scrapedImage = explode('src="',$scrapedImage); | |
$scrapedImage = str_replace('">', '', $scrapedImage[1]); | |
die($scrapedImage); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment