Może pokażę ten skrypt.
function file_get_contents_curl($url) {
$cookie = 'bbnaut=' . urlencode('2458561058e5cfaa') . '; welcomeScreenNew=' . urlencode('welcomeScreen'); $ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
// Szukaj
$data = file_get_contents_curl('http://www.filmweb.pl/search?q='.$rs);
preg_match('#<a class=searchResultTitle href="(.*)">#',$data,$out);
// Faktyczne pobieranie filmu.
$dane = file_get_contents_curl('http://www.filmweb.pl'.$dans[0]);
preg_match('#<span id=filmYear class=halfSize>(.*)</span>#',$dane,$rok); preg_match('#property="v:name" property="v:itemreviewed">(.*)</h1><span id=filmYear class=halfSize>#',$dane,$nazwa); preg_match('#<h2 class="text-large caption">(.*)</h2><div class=hide>#',$dane,$nazwa2); preg_match('#</tr><tr><th>produkcja:</th><td><ul class="inline sep-comma">(.*)</ul></td></tr><tr><th>premiera:</th>#',$dane,$produkcja); preg_match('#<p class=text property="v:summary">(.*)</p></div><div class="pageBox sep-hr">#',$dane,$opis); preg_match('#rel="v:directedBy">(.*)</a></li></ul></td></tr><tr><th>scenariusz:</th>#',$dane,$rez); preg_match('#<i class=icon-small-clock></i> (.*)</div><div class=communityRate>#',$dane,$time); preg_match('#class=film_mini><img src="(.*)"#',$dane,$ss); preg_match('#<div class=filmInfo><table><tr><th>gatunek:</th><td><ul class="inline sep-comma">(.*)</ul></td></tr><tr><th>produkcja:</th>#',$dane,$gatunek);
$fotka = explode('" alt="', $ss[1
]);
$HTML = $produkcja[1];
$HTML1 = $gatunek[1];
$html = new DOMDocument();
$html1 = new DOMDocument();
$html->validateOnParse = false;
$html1->validateOnParse = false;
$html->loadHTML($HTML);
$html1->loadHTML($HTML1);
foreach ( $html->getElementsByTagName('a') as $link ) {$links[] = $link->nodeValue;}
foreach ( $html1->getElementsByTagName('a') as $link1 ) {$links1[] = $link1->nodeValue;}
$tablica = $links;
$tablica1 = $links1;
$produk = '';
$gatun = '';
$ile1 = count($tablica1); for ($i=0; $i <$ile; $i++){$produk .= $tablica[$i].', ';}
for ($i=0; $i <$ile1; $i++){$gatun .= $tablica1[$i].', ';}
$link_put = 'http://www.putlocker.com/file/'.$r['link'].'';
if($nazwa_pl and $link_put) {
INSERT INTO bot_film_gen SET
nazwapl = '".$nazwa_pl."',
nazwaen = '".$nazwa_en."',
rez = '".$rez_pl."',
prod = '".$produk."',
czas = '".$czas_p."',
czast = '".$czas."',
opis = '".$opis_pl."',
fotka = '".$fotka[0]."',
link = '".$link_put."',
name = '".$rs."',
gatunek = '".$gatun."',
ids = '".$r['id']."'
");}
}
Co prawda jest to troszkę powtórzone te zmienne ale raczej nie powinno to tak spowalniać serwera...
Pozdrawiam.