php - get images files with different parts in names -
hi guys have problem images different parts in names, let me explain more. in directory have many pictures format in name : 1-[1-9].jpg or 2-[1-9].jpg or ... example names can 1-5.jpg or 1-14.jpg or 2-3.jpg dont know true way files!!
this example want:
function get_data($url) { $ch = curl_init(); $timeout = 5; curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_useragent, "mozilla/4.0 (compatible; msie 8.0; windows nt 6.0)"); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_ssl_verifyhost,false); curl_setopt($ch, curlopt_ssl_verifypeer,false); curl_setopt($ch, curlopt_maxredirs, 10); curl_setopt($ch, curlopt_followlocation, 1); curl_setopt($ch, curlopt_connecttimeout, $timeout); $data = curl_exec($ch); curl_close($ch); return $data; } $diff = [1-9]; $html = get_data('http://mysite.info/screenshots/1-' . $diff. '.jpeg' );
if 1 of server, should figure out pattern of image file names, example, x-y.jpeg
, x
1 100, , y
1 9. process code:
foreach (range(1, 100) $x) { foreach (range(1, 9) $y) { $html = get_data('http://mysite.info/screenshots/'.$x.'-'.$y.'.jpeg' ); } }
Comments
Post a Comment