- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
<?php
iconv_set_encoding("input_encoding", "UTF-8");
iconv_set_encoding("internal_encoding", "UTF-8");
iconv_set_encoding("output_encoding", "UTF-8");
$curl = curl_init();
$curl_set = array(
CURLOPT_COOKIESESSION => 0,
CURLOPT_VERBOSE => 1,
CURLOPT_USERAGENT => 'Opera/9.60 (J2ME/MIDP; Opera Mini/4.2.14912/812; U; ru) Presto/2.4.15',
CURLOPT_RETURNTRANSFER => 1
);
curl_setopt_array($curl, $curl_set);
for($i=1;$i<50;$i++){
$url = 'http://utemplate.ru/load/19-1-0-'.$i;
curl_setopt($curl, CURLOPT_URL ,$url);
$data = curl_exec($curl);
preg_match_all('#<div class="entrytitle">(.*)</div>(.*)<hr>#isU', $data, $matches);
$content[title] = $matches[1][0];
$content[desc] = $matches[2][0];
unset($matches);
preg_match_all('#<img src\="http://utemplate.ru/_ld/0/(.*)"/>#isU', $data, $matches);
$content[img] = $matches[1][0];
if($content[title] AND $content[desc] AND $content[img]){
unset($matches);
mkdir($content[title], 0777);
curl_setopt($curl, CURLOPT_URL ,'http://utemplate.ru/_ld/0/'.$content[img]);
$image = curl_exec($curl);
curl_setopt($curl, CURLOPT_URL ,'http://utemplate.ru/load/0-0-0-'.$i.'-20');
$file_inf = curl_exec($curl);
preg_match_all('#<A HREF="(.*)"#isU', $file_inf, $matches);
$ext_file = substr($matches[1][0], -4);
$ext_img = substr($content[img], -4);
curl_setopt($curl, CURLOPT_URL , $matches[1][0]);
$file = curl_exec($curl);
file_put_contents($content[title].'/'.$content[title].$ext_file, $file);
file_put_contents($content[title].'/'.$content[title].$ext_img, $image);
file_put_contents($content[title].'/'.$content[title].'.txt', $content[title]."\n".$content[desc]);
}
};