65. Dasturist (25) [off]
|
TXT |
38| 6 May 2019, 21:39
root (6 May 2019, 19:49):
Dasturist, unday bolsa ozroq harakat qiling qandaydur fileni tashlab shuni qilib ber demasdan shunday qildim uxshamadi yordam ber den bu togri• • •
root,
<?php
//Отключаем лимит ожидания и объявляем переменные
set_time_limit(0);
$content=NULL;$num_pages=NULL;
//Подключение к базе
//Подключаемся к базе данных
define ("HOST", "localhost");
define ("dаtаBASE", "ваша база данных");
define ("MYSQL_USER", "ваш юзер");
define ("MYSQL_PASS", "ваш пароль");
mysql_connect(HOST, MYSQL_USER, MYSQL_PASS);mysql_query("set names utf8");mysql_select_db(dаtаBASE);
//Узнаём кол-во страниц
$content=file_get_contents('http://bash.im/');
preg_match('|max="(.*?)"|is',$content,$num_pages);
//Парсим каждую страницу
for ($i=1; $i <= $num_pages[1]; $i++){$i2=false;
//Грузим страницы, вырезаем цитаты
$content=file_get_contents('http://bash.im/index/'.$i);
$quotes=explode('<span class="date">',$content);
foreach($quotes as $quote){
if($i2==false){$i2=true;continue;}
//Номер цитаты
preg_match('|class="id"><a href='/search.php?q=(.*?)</a>|is',$quote,$quote_id);&d=2'>#(.*?)</a>|is',$quote,$quote_id);</a>
//Текст цитаты
preg_match('|<div class="text">(.*?)</div>|is',$quote,$quote_text);
//Конвертация текста в UTF-8 и экранирование символов
$quote_text=strip_tags(addslashes(htmlspecialchars(trim(iconv("windows-1251","UTF-8",$quote_text[1])))));
//Вписываем в базу
if($quote_text!=NULL){mysql_query("INSERT INTO `bash`(`id`,`quote_id`,`quote_text`) VALUES (NULL,'{$quote_id[1]}','{$quote_text}')");}
}
//От перенагрузки
sleep(2);
}
?>
kodni ham yozib qo'yaveray hullas johncms.com/library dagi maqolalarni meni saytimni bazasiga yozib beradigan qilish kerak shunga azgina aql yetmey turipti
59 sekunddan so'ng qo'shdi...
fayl yuklab bo'lmadi
70. Boss (478) [off]
|
TXT |
15| 24 Jul 2019, 12:25
MasTeR_BiN (24 Jul 2019, 01:05):
Men Brigand tarqatgan grabberdi o'rnatgandim lekin dizayn o'zgarib qolyabdi nimadan bo'lishi mimkin?
MasTeR_BiN, Manzilini özgartirish kerakda