Improve company productivity with a Business Account.Sign Up
Are you ready to take your data science career to the next step, or break into data science? With Springboard’s Data Science Career Track, you’ll master data science topics, have personalized career guidance, weekly calls with a data science expert, and a job guarantee.
<?php // RAY_temp_gallitin.php
// READ THE FOREIGN PAGE
$htm = file_get_contents('http://www.caught.com/index/sexy-and-funny-gallery-xxiv/');
// SCRAPE THE PAGE DATA WITH THESE KEY ELEMENTS
$dlm1 = "<div id='gallery-1'";
$dlm2 = "<br style='clear: both;' />";
$dlm3 = '<img ';
// REMOVE FRONT AND BACK OF HTML
$arr = explode($dlm1, $htm);
$htm = $dlm1 . $arr;
$arr = explode($dlm2, $htm);
$htm = $arr;
// REMOVE WHITESPACE AND COMPRESS
$str = preg_replace('/\s\s+/', ' ', $htm);
// CREATE AN ITERATOR
$new = array();
$arr = explode($dlm3, $str);
foreach ($arr as $thing)
// IMAGE TAGS HAVE WIDTH IN A CONSISTENT PLACE
if (substr($thing,0,3) != 'wid') continue;
// REMOVE EXTRANEOUS STUFF - SAVE THE IMAGE URL
$poz = strpos($thing, '>');
$thing = substr($thing, 0, $poz+1);
$new = $dlm3 . $thing;
// SHOW THE WORK PRODUCT
Open in new window
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.