Skip to content

Instantly share code, notes, and snippets.

@kooler62
Last active August 29, 2015 14:21
Show Gist options
  • Select an option

  • Save kooler62/6c9f66be4e99e88352b7 to your computer and use it in GitHub Desktop.

Select an option

Save kooler62/6c9f66be4e99e88352b7 to your computer and use it in GitHub Desktop.
парсер php
<?
//запуск секундомера
$start = microtime(true);
# масив ссылок
$urls = array(
'http://liveandlearn.com.ua/dayte-meni-tisyachu-rokiv-i-ya-rozmalyuyu-nebo/',
'http://liveandlearn.com.ua/vse-v-nashih-rukah/',
'http://liveandlearn.com.ua/slipiy-ta-lihtar/'
);
foreach ($urls as $url) {
$ch = curl_init();
// Параметры курла
#
curl_setopt($ch, CURLOPT_USERAGENT, 'IE20');
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
# отключаем проверку сертификата
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
# Убираем вывод данных в браузер. Пусть функция их возвращает а не выводит (1)
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Получаем html
$text = curl_exec($ch);
//echo curl_exec($ch);
curl_close($ch);
}
$time = microtime(true) - $start;
printf('Скрипт выполнялся %.4F сек.', $time);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment