function testBetweenTag() { $text = '<p>test</p><div>I am test <div class="test">Hi<div> you are cool Проверка UTF8</div></div>:)</div>'; $inTag = DryHtml::betweenTag($text, '<div class="test">'); $withTag = DryHtml::betweenTag($text, '<div class="test">', false); $resultInTag = 'Hi<div> you are cool Проверка UTF8</div>'; $resultWithTag = '<div class="test">Hi<div> you are cool Проверка UTF8</div></div>'; $this->assertEquals($resultInTag, $inTag); $this->assertEquals($resultWithTag, $withTag); }
* User: EC * Date: 14.05.13 * Time: 3:35 * Project: GetContent * @author: Evgeny Pynykh bpteam22@gmail.com */ use bpteam\Loader\Loader; use bpteam\DryText\DryPath; use bpteam\DryText\DryHtml; use bpteam\ProxyList\ProxyUpdate; return array(); $urlSource = "http://spys.ru/aproxy/"; $nameSource = "spys.ru"; /** * @var Loader|\bpteam\Loader\LoaderSingleCurl $curl */ $curl = new Loader('LoaderSingleCurl'); $updateProxy = new ProxyUpdate(); $curl->setTypeContent("html"); $curl->setDefaultOption(CURLOPT_POST, true); $curl->setDefaultOption(CURLOPT_POSTFIELDS, 'sto=%CF%EE%EA%E0%E7%E0%F2%FC+200'); $answerSpys = $curl->load($urlSource); $answerSpys = DryHtml::betweenTag($answerSpys, '<table width="100%" BORDER=0 CELLPADDING=1 CELLSPACING=1>'); $ips = DryPath::getIp($answerSpys); if ($ips) { foreach ($ips as $valueSpys) { $proxySpysProxy[] = trim($valueSpys); } } $updateProxy->saveSource($nameSource, $proxySpysProxy); return $proxySpysProxy;
* User: EC * Date: 14.05.13 * Time: 3:26 * Project: GetContent * @author: Evgeny Pynykh bpteam22@gmail.com */ use bpteam\Loader\Loader; use bpteam\DryText\DryPath; use bpteam\DryText\DryHtml; use bpteam\ProxyList\ProxyUpdate; $urlSource = "http://xseo.in/freeproxy"; $nameSource = "xseo.in"; /** * @var Loader|\bpteam\Loader\LoaderSingleCurl $curl */ $curl = new Loader('LoaderSingleCurl'); $updateProxy = new ProxyUpdate(); $curl->setTypeContent("html"); $curl->setDefaultOption(CURLOPT_POST, true); $curl->setDefaultOption(CURLOPT_POSTFIELDS, 'submit=%CF%EE%EA%E0%E7%E0%F2%FC+%EF%EE+100+%EF%F0%EE%EA%F1%E8+%ED%E0+%F1%F2%F0%E0%ED%E8%F6%E5'); $answerXseo = $curl->load($urlSource); $proxyXseoProxy = array(); $answerXseo = DryHtml::betweenTag($answerXseo, '<table width="100%" BORDER=0 CELLPADDING=0 CELLSPACING=1>', false); $ips = DryPath::getIp($answerXseo); if ($ips) { foreach ($ips as $value_xseo) { $proxyXseoProxy[] = trim($value_xseo); } } $updateProxy->saveSource($nameSource, $proxyXseoProxy); return $proxyXseoProxy;
*/ use bpteam\Loader\Loader; use bpteam\DryText\DryPath; use bpteam\DryText\DryHtml; use bpteam\ProxyList\ProxyUpdate; $urlSource = "http://foxtools.ru/Proxy?page="; $nameSource = "foxtools.ru"; $curl = new Loader('LoaderSingleCurl'); $updateProxy = new ProxyUpdate(); $curl->setTypeContent("html"); $proxyFoxtools = array(); for ($nom = 1; $nom < 50; $nom++) { $urlPage = $urlSource . $nom; $answerFoxtools = $curl->load($urlPage); if (!$answerFoxtools) { break; } $answerFoxtools = DryHtml::betweenTag($answerFoxtools, '<table style="width:100%" id="theProxyList">'); if (!preg_match_all('%<td\\s*style="[^"]*">(?<ip>\\d+.\\d+.\\d+.\\d+)</td>\\s*<td\\s*style="[^"]*">(?<port>\\d+)</td>%imsu', $answerFoxtools, $matchesIp)) { break; } foreach ($matchesIp['ip'] as $key => $proxyIp) { $proxyAddress = $proxyIp . ':' . $matchesIp['port'][$key]; if (DryPath::isIp($proxyAddress)) { $proxyFoxtools[] = trim($proxyAddress); } } sleep(rand(1, 3)); } $updateProxy->saveSource($nameSource, $proxyFoxtools); return $proxyFoxtools;
/** * Created by JetBrains PhpStorm. * User: EC * Date: 14.05.13 * Time: 2:36 * Project: GetContent * @author: Evgeny Pynykh bpteam22@gmail.com */ use bpteam\Loader\Loader; use bpteam\DryText\DryPath; use bpteam\DryText\DryHtml; use bpteam\ProxyList\ProxyUpdate; $urlSource = "http://www.poststar.ru/proxy.htm"; $nameSource = "poststar.ru"; $curl = new Loader('LoaderSingleCurl'); $updateProxy = new ProxyUpdate(); $curl->setTypeContent("html"); $answerPoststar = $curl->load($urlSource); $answerPoststar = DryHtml::betweenTag($answerPoststar, '<table width="730" border="0" align="center">'); $proxyPoststarProxy = []; $ips = DryPath::getIp($answerPoststar); if ($ips) { foreach ($ips as $valuePoststar) { $valuePoststar = trim($valuePoststar); if (DryPath::isIp($valuePoststar)) { $proxyPoststarProxy[] = $valuePoststar; } } } $updateProxy->saveSource($nameSource, $proxyPoststarProxy); return $proxyPoststarProxy;