Skip to content

Instantly share code, notes, and snippets.

@midoooo

midoooo/test Secret

Created July 11, 2015 16:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save midoooo/df6e25b3b46753089e1b to your computer and use it in GitHub Desktop.
Save midoooo/df6e25b3b46753089e1b to your computer and use it in GitHub Desktop.
include_once('simple_html_dom.php');
$url = $_GET['u'];
$html = file_get_html($url);
function newURLimg($nURL)
{
$source = array('https', 'thumb');
$replace = array('http', 'src');
$nURL = str_replace($source, $replace, $nURL);
return $nURL;
}
foreach($html->find('img[class=full]') as $element)
{
$new = newURLimg($element->src);
echo $new . '<br>';
/* Output:
http://ex.example-site.com/test/src/1234567890.jpg
http://ex.example-site.com/test/src/1234567809.jpg
http://ex.example-site.com/test/src/1234056798.jpg
*/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment