作者:thierrymariann
项目:MttBundl
public function getPdfHash($html, $cssVersion)
{
$crawler = new Crawler($html);
$layoutWrapper = $crawler->filter('div#layout-main-wrapper');
$htmlHash = $this->getHtmlHash($layoutWrapper);
return md5($htmlHash . $cssVersion);
}
作者:predeve
项目:keos
/**
* Display a page in studio and allow to add/edit gadget
* @param $id id of the page to display
*/
public function viewAction($id)
{
//Curent app id
$appid = $this->get('keosu_core.curapp')->getCurApp();
$em = $this->get('doctrine')->getManager();
//Get the page we want to edit
$page = $em->getRepository('KeosuCoreBundle:Page')->find($id);
//Page Template content as String
$templateHtml = file_get_contents(TemplateUtil::getPageTemplateAbsolutePath() . $page->getTemplateId());
//Get all the elements of class "zone" in template dom
$crawler = new Crawler($templateHtml);
$zones = $crawler->filter('.zone')->extract(array('id'));
//Initiate an Array to store all zone in page
$zoneModelList = array();
foreach ($zones as $zone) {
//Look if there is a shared gadget in this zone
$gadget = $em->getRepository('KeosuCoreBundle:Gadget')->findSharedByZoneAndApp($zone, $appid);
//If there is no share gadget we try to find the specific one
if ($gadget == null) {
//Find the gadget associated with page and zone
$gadget = $em->getRepository('KeosuCoreBundle:Gadget')->findOneBy(array('zone' => $zone, 'page' => $id));
}
$zoneModel = array();
$zoneModel['gadget'] = $gadget;
$zoneModel['zoneId'] = $zone;
$zoneModelList[] = $zoneModel;
}
$gadgetList = array();
$packageList = $this->get('keosu_core.package_manager')->getPackageList(PackageManager::TYPE_PACKAGE_GADGET);
foreach ($packageList as $p) {
$gadgetList[] = $p->getName();
}
return $this->render('KeosuCoreBundle:Page:studio.html.twig', array('page' => $page, 'zones' => $zoneModelList, 'templatehtml' => $templateHtml, 'gadgets' => $gadgetList));
}
作者:simonstam
项目:laravel-pja
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$app = $this->app;
$this->app->after(function ($request, $response) use($app) {
// Only handle non-redirections
if (!$response->isRedirection()) {
// Must be a pjax-request
if ($request->server->get('HTTP_X_PJAX')) {
$crawler = new Crawler($response->getContent());
// Filter to title (in order to update the browser title bar)
$response_title = $crawler->filter('head > title');
// Filter to given container
$response_container = $crawler->filter($request->server->get('HTTP_X_PJAX_CONTAINER'));
// Container must exist
if ($response_container->count() != 0) {
$title = '';
// If a title-attribute exists
if ($response_title->count() != 0) {
$title = '<title>' . $response_title->html() . '</title>';
}
// Set new content for the response
$response->setContent($title . $response_container->html());
}
// Updating address bar with the last URL in case there were redirects
$response->header('X-PJAX-URL', $request->getRequestUri());
}
}
});
}
作者:nicoladarol
项目:addresscrawle
protected function execute(InputInterface $input, OutputInterface $output)
{
// read url parameter
$url = $input->getArgument('url');
// read page parameter
$page = $input->getArgument('page');
if (is_numeric($page)) {
$url = $url . "?page=" . $page;
}
// get url content
$pageContent = file_get_contents($url);
if ($pageContent !== false) {
$ph = new PersonHandler();
$ph->setPersonsUrl($url);
// read persons table
$crawler = new Crawler($pageContent);
$rowElements = $crawler->filter('.view-persona .view-content table.views-table tbody tr');
// extract each Person
/* @var $rowElement DOMElement */
foreach ($rowElements as $rowElement) {
$p = new Person();
$ph->readInfo($p, $rowElement);
$output->writeln($p->toCsv());
}
}
}
作者:Tugar
项目:parse
public function productAction()
{
$client = new Client('http://stroyka.by');
$request = $client->get('/');
$request->send();
$resault = $request->getResponse()->getBody(true);
$crawler = new Crawler();
// $crawler->addHTMLContent($resault);
// $res = $request->getResponse()->getH;
// var_dump($res);exit();
// $text = utf8_decode($resault);
$crawler = new Crawler($resault);
$resault = $crawler->filter('ul.b-categories')->html();
//
//
// $crowler2 = new Crawler($resault);
//
// $resault = $crowler2->filter('span.b-categories__name');
//
// $nodeValues = $crawler->filter('span.b-categories__name')->each(function (Crawler $node, $i) {
// return utf8_decode($node->text());
// });
// var_dump(mb_detect_encoding($nodeValues[0]));exit();
// foreach($nodeValues as $nv) {
// $category = new Category();
// $category->setName($nv);
// $this->getDoctrine()->getManager()->persist($category);
// }
// $this->getDoctrine()->getManager()->flush();
// var_dump($nodeValues);
// var_dump($resault);
// exit;
return $this->render('AcmeAppBundle:Default:product.html.twig', array('result' => $resault));
}
作者:GoZO
项目:DrupalConsol
protected function execute(InputInterface $input, OutputInterface $output)
{
$httpClient = $this->getHttpClientHelper();
$site_name = $input->getArgument('site-name');
$version = $input->getArgument('version');
if ($version) {
$release_selected = $version;
} else {
// Getting Module page header and parse to get module Node
$output->writeln('[+] <info>' . sprintf($this->trans('commands.site.new.messages.getting-releases')) . '</info>');
// Page for Drupal releases filter by Drupal 8
$project_release_d8 = 'https://www.drupal.org/node/3060/release?api_version%5B%5D=7234';
// Parse release module page to get Drupal 8 releases
try {
$html = $httpClient->getHtml($project_release_d8);
} catch (\Exception $e) {
$output->writeln('[+] <error>' . $e->getMessage() . '</error>');
return;
}
$crawler = new Crawler($html);
$releases = [];
foreach ($crawler->filter('span.file a') as $element) {
if (strpos($element->nodeValue, ".tar.gz") > 0) {
$release_name = str_replace('.tar.gz', '', str_replace('drupal-', '', $element->nodeValue));
$releases[$release_name] = $element->nodeValue;
}
}
if (empty($releases)) {
$output->writeln('[+] <error>' . $this->trans('commands.module.site.new.no-releases') . '</error>');
return;
}
// List module releases to enable user to select his favorite release
$questionHelper = $this->getQuestionHelper();
$question = new ChoiceQuestion('Please select your favorite release', array_combine(array_keys($releases), array_keys($releases)), 0);
$release_selected = $questionHelper->ask($input, $output, $question);
}
$release_file_path = 'http://ftp.drupal.org/files/projects/drupal-' . $release_selected . '.tar.gz';
// Destination file to download the release
$destination = tempnam(sys_get_temp_dir(), 'drupal.') . "tar.gz";
try {
// Start the process to download the zip file of release and copy in contrib folter
$output->writeln('[+] <info>' . sprintf($this->trans('commands.site.new.messages.downloading'), $release_selected) . '</info>');
$httpClient->downloadFile($release_file_path, $destination);
$output->writeln('[+] <info>' . sprintf($this->trans('commands.site.new.messages.extracting'), $release_selected) . '</info>');
$zippy = Zippy::load();
$archive = $zippy->open($destination);
$archive->extract('./');
try {
$fs = new Filesystem();
$fs->rename('./drupal-' . $release_selected, './' . $site_name);
} catch (IOExceptionInterface $e) {
$output->writeln('[+] <error>' . sprintf($this->trans('commands.site.new.messages.error-copying'), $e->getPath()) . '</error>');
}
$output->writeln('[+] <info>' . sprintf($this->trans('commands.site.new.messages.downloaded'), $release_selected, $site_name) . '</info>');
} catch (\Exception $e) {
$output->writeln('[+] <error>' . $e->getMessage() . '</error>');
return;
}
return true;
}
作者:blowsk
项目:sainsburys-crawle
public function setUp()
{
$html = file_get_contents(__DIR__ . '/../Fixtures/category-page-product-node.html');
$crawler = new Crawler();
$crawler->addHtmlContent($html, 'ISO-8859-1');
$this->SUT = new SUT($crawler);
}
作者:siad00
项目:scryph
public function process()
{
$crawler = $this->client->request($this->plan['method'], $this->plan['uri']);
if (isset($this->plan['selector'])) {
$selection = $crawler->filter($this->plan['selector']);
} elseif (isset($this->plan['xpath'])) {
$selection = $crawler->filterXPath($this->plan['path']);
}
if ($this->plan['images']) {
$images = $selection->filterXPath('//img');
if (iterator_count($images) > 1) {
foreach ($images as $image) {
$crawler = new Crawler($image);
$info = parse_url($this->plan['uri']);
$url = $info['scheme'] . '://' . $info['host'] . '/' . $crawler->attr('src');
if (strpos($crawler->attr('src'), 'http') === 0) {
$url = $info['scheme'] . '://' . $info['host'] . '/' . $this->plan['path'] . $crawler->attr('src');
}
copy($url, SCRYPHP_STORAGE_PATH_IMG . DIRECTORY_SEPARATOR . substr(strrchr($url, "/"), 1));
}
}
}
file_put_contents(SCRYPHP_STORAGE_PATH_TXT . DIRECTORY_SEPARATOR . time() . uniqid(time(), true) . '.txt', $selection->text());
return $selection->text();
}
作者:samirios
项目:nite
/**
* Scrapes single news item from screenrant
*
* @param string $url
* @return string
*/
public function getSingleFromScreenRant($url)
{
$text = '';
$item = $this->curl($url);
$crawler = new Crawler($item);
$html = $crawler->filter('div[itemprop="articleBody"] p')->each(function (Crawler $node, $i) {
$ht = trim($node->html());
//filter out unneeded html
if (strpos($ht, 'contentjumplink')) {
return false;
}
if (strpos($ht, 'type="button"')) {
return false;
}
if (strpos($ht, 'type="hidden"')) {
return false;
}
if (strpos($ht, 'AD BLOCK')) {
return false;
}
if (strpos($ht, 'src=')) {
preg_match('/.*?<img src="(.*?)"/', $ht, $m);
if (isset($m[1])) {
return "<img src='{$m[1]}' class='img-responsive'/>";
}
}
return '<p>' . preg_replace('/<a.*?>(.*?)<\\/a>/', '$1', $ht) . '</p>';
});
return trim(implode('', $html));
}
作者:michaelotto12
项目:shoke
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
/** @var $response Response */
$response = $next($request);
// Only handle non-redirections and must be a pjax-request
if (!$response->isRedirection() && $request->pjax()) {
$crawler = new Crawler($response->getContent());
// Filter to title (in order to update the browser title bar)
$response_title = $crawler->filter('head > title');
// Filter to given container
$response_container = $crawler->filter($request->header('X-PJAX-CONTAINER'));
// Container must exist
if ($response_container->count() != 0) {
$title = '';
// If a title-attribute exists
if ($response_title->count() != 0) {
$title = '<title>' . $response_title->html() . '</title>';
}
// Set new content for the response
$response->setContent($title . $response_container->html());
}
// Updating address bar with the last URL in case there were redirects
$response->header('X-PJAX-URL', $request->getRequestUri());
}
return $response;
}
作者:kipelovet
项目:rs
/**
* @param Show $show
* @param Episode $episode
* @param Crawler $page
* @return null|string
*/
protected function extractMagnetUrl(Show $show, Episode $episode, Crawler $page)
{
$nodes = $page->filter(".detName");
if ($nodes->count() == 0) {
return null;
}
$tr = $page->filter('#searchResult tr')->eq(1);
$link = new MagnetLink();
$a = $tr->filter('td')->eq(1)->filter('a')->eq(0);
if (!$a) {
return null;
}
$link->setDetailsLink("http://{$this->domain}{$a->attr('href')}");
$link->setLink(trim($tr->filter('a[title="Download this torrent using magnet"]')->attr('href')));
$link->setTitle(trim($tr->filter('.detName')->eq(0)->text()));
$desc = $tr->filter('.detDesc')->text();
if (!preg_match('/^\\S+ (.*), .*\\s(\\S+)\\s.*,.*\\s(.*)$/', $desc, $matches)) {
return null;
}
$link->setUploaded(trim($matches[1]));
$link->setSize(trim($matches[2]));
$link->setAuthor(trim($matches[3]));
$link->setSeeds(trim($tr->filter('td')->eq(2)->text()));
$link->setLeeches(trim($tr->filter('td')->eq(3)->text()));
$link->setEpisode($episode);
$link->setShow($show);
return $link;
}
作者:donatienthore
项目:sf_mobilIT_backEn
/**
* @param $codeCountry
*
* @return Crawler
*/
private function filterCountryDetails($codeCountry)
{
$htmlCountry = file_get_contents('https://galaxy.esn.org/section/' . $codeCountry . "/");
$crawlerCountry = new Crawler($htmlCountry);
$countriesElement = $crawlerCountry->filter('div.scrinfo');
return $countriesElement;
}
作者:slice-bean
项目:cli-ap
/**
* @param string $url The url to scrape.
* @return \Slice\CliApp\ScrapeResults The results of the scrape task.
*/
public function getProductsForUrl($url)
{
//Grab the remote document contents
$rawHTML = $this->downloader->download($url);
//Drop it into a DOM crawler
$crawler = new Crawler();
$crawler->addContent($rawHTML);
try {
//Use xPath to find all of the product li elements
$productList = $crawler->filterXPath($this->productListXpath);
} catch (\InvalidArgumentException $e) {
//Convert into a Scrape Exception for easy handling by the command
throw new ScrapeException($this->configValues['error_msg']['product_parse_error']);
}
//If there are none the page isn't supported
if (sizeof($productList) == 0) {
throw new ScrapeException($this->configValues['error_msg']['no_products']);
}
//Loop over each product li
$productList->each(function ($liCrawler, $i) {
try {
//Find the product detail page url from the link
$productURL = $liCrawler->filterXPath($this->pdpLinkXpath)->attr('href');
} catch (\InvalidArgumentException $e) {
//Convert into a Scrape Exception for easy handling by the command
throw new ScrapeException($this->configValues['error_msg']['product_parse_error']);
}
$product = $this->pdpParser->parseUrl($productURL);
//Populate the final results container
$this->results->addProduct($product);
});
return $this->results;
}
作者:aszon
项目:hackin
public function isJoomla()
{
$baseUrlJoomla = $this->target;
$validExtension = preg_match("/^.*\\.(jpg|JPG|gif|GIF|doc|DOC|pdf|PDF)\$/", $this->target, $m);
if ($validExtension) {
$baseUrlJoomla = $this->getBaseUrlJoomla();
}
$header = new FakeHeaders();
try {
$client = new Client(['defaults' => ['headers' => ['User-Agent' => $header->getUserAgent()], 'proxy' => $this->proxy, 'timeout' => 30]]);
$body = $client->get($baseUrlJoomla)->getBody()->getContents();
$crawler = new Crawler($body);
$arrLinksMeta = $crawler->filter('meta');
foreach ($arrLinksMeta as $keyLinkMeta => $valueLinkMeta) {
$validJoomlaMeta = preg_match('/Joomla!/', $valueLinkMeta->getAttribute('content'), $m, PREG_OFFSET_CAPTURE);
if ($validJoomlaMeta) {
return true;
}
}
$arrLinksScript = $crawler->filter('script');
foreach ($arrLinksScript as $keyLinkScript => $valueLinkScript) {
$validJoomlaScript = preg_match("/(\\/media\\/system\\/js\\/mootools(.js|-core.js))/", $valueLinkScript->getAttribute('src'), $m, PREG_OFFSET_CAPTURE);
if ($validJoomlaScript) {
return true;
}
}
} catch (\Exception $e) {
return false;
}
return false;
}
作者:xurumelou
项目:torrent-scrape
/**
* @param string $query
* @return SearchResult[]
*/
public function search($query)
{
try {
$response = $this->httpClient->get('http://kickasstorrents.to/usearch/' . urlencode($query) . '/');
} catch (\GuzzleHttp\Exception\ClientException $e) {
return [];
}
$crawler = new Crawler((string) $response->getBody());
$items = $crawler->filter('#mainSearchTable tr');
$results = [];
$i = 0;
foreach ($items as $item) {
// Ignores advertisement and header
if ($i < 2) {
$i++;
continue;
}
$itemCrawler = new Crawler($item);
$name = $itemCrawler->filter('.cellMainLink')->text();
if (!stristr($name, $query)) {
continue;
}
$data = json_decode(str_replace("'", '"', $itemCrawler->filter('div[data-sc-params]')->attr('data-sc-params')));
$result = new SearchResult();
$result->setName($name);
$result->setSeeders((int) $itemCrawler->filter('td:nth-child(5)')->text());
$result->setLeechers((int) $itemCrawler->filter('td:nth-child(6)')->text());
$result->setMagnetUrl($data->magnet);
$results[] = $result;
}
return $results;
}
作者:maidmai
项目:cffi
public function query($departure, $arrival, \DateTime $date = null)
{
$date = $date ? $date : new \DateTime();
$fmt = new \IntlDateFormatter('en_EN', \IntlDateFormatter::FULL, \IntlDateFormatter::NONE, date_default_timezone_get(), \IntlDateFormatter::TRADITIONAL);
$response = $this->client->post('bin/query.exe/fn', array('headers' => array('host' => 'fahrplan.sbb.ch', 'origin' => 'http://fahrplan.sbb.ch', 'referer' => 'http://fahrplan.sbb.ch/bin/query.exe/fn'), 'form_params' => array('queryPageDisplayed' => 'yes', 'HWAI=JS!ajax' => 'yes', 'HWAI=JS!js' => 'yes', 'HWAI' => '~CONNECTION!', 'REQ0Total_KissRideMotorClass' => '404', 'REQ0Total_KissRideCarClass' => '5', 'REQ0Total_KissRide_maxDist' => '10000000', 'REQ0Total_KissRide_minDist' => '0', 'REQComparisonCarload' => '0', 'REQ0JourneyStopsS0G' => $departure['value'], 'REQ0JourneyStopsS0ID' => $departure['id'], 'REQ0JourneyStopsS0A' => '255', 'REQ0JourneyStopsZ0G' => $arrival['value'], 'REQ0JourneyStopsZ0ID' => $arrival['id'], 'REQ0JourneyStopsZ0A' => '255', 'REQ0JourneyStops1.0G' => '', 'REQ0JourneyStops1.0A' => '1', 'REQ0JourneyStopover1' => '', 'date' => sprintf('%s, %s', substr($fmt->format($date), 0, 2), $date->format('d-m-y')), 'REQ0JourneyTime' => $date->format('H:i'), 'REQ0HafasSearchForw' => '1', 'REQ0JourneyStops2.0G' => '', 'REQ0JourneyStops2.0A' => '1', 'REQ0JourneyStopover2' => '', 'REQ0JourneyStops3.0G' => '', 'REQ0JourneyStops3.0A' => '1', 'REQ0JourneyStopover3' => '', 'REQ0JourneyStops4.0G' => '', 'REQ0JourneyStops4.0A' => '1', 'REQ0JourneyStopover4' => '', 'REQ0JourneyStops5.0G' => '', 'REQ0JourneyStops5.0A' => '1', 'REQ0JourneyStopover5' => '', 'existOptimizePrice' => '0', 'existUnsharpSearch' => 'yes', 'REQ0HafasChangeTime' => '0:1', 'existHafasAttrExc' => 'yes', 'REQ0JourneyProduct_prod_0' => '1', 'existProductBits0' => 'yes', 'REQ0JourneyProduct_prod_1' => '1', 'REQ0JourneyProduct_prod_2' => '1', 'REQ0JourneyProduct_prod_3' => '1', 'REQ0JourneyProduct_prod_4' => '1', 'REQ0JourneyProduct_prod_5' => '1', 'REQ0JourneyProduct_prod_6' => '1', 'REQ0JourneyProduct_prod_7' => '1', 'REQ0JourneyProduct_prod_8' => '1', 'REQ0JourneyProduct_prod_9' => '1', 'REQ0JourneyProduct_opt_section_0_list' => '0:0000', 'disableBaim' => 'yes', 'REQ0HafasHandicapLimit' => '4:4', 'changeQueryInputData' => 'yes', 'start' => 'Chercher correspondance')));
$crawler = new Crawler(utf8_encode((string) $response->getBody()));
$overviews = array();
$date = '';
// Get overviews
$crawler->filter('.hfs_overview .overview')->each(function (Crawler $node) use(&$overviews, &$date) {
// Update date
if (false !== strpos($node->getNode(0)->getAttribute('class'), 'dateHint')) {
// Subtract 8 last chars
$date = substr($text = trim($node->text()), ($len = strlen($text)) - 8, $len);
return;
}
$overviews[] = array_filter(array($date, count($n = $node->filter('.time.departure')) ? substr(trim($n->text()), 0, 5) : null, count($n = $node->filter('.time.arrival')) ? substr(trim($n->text()), 0, 5) : null, count($n = $node->filter('.duration')) ? trim($n->text()) : null, count($n = $node->filter('.changes')) ? trim($n->text()) : null, count($n = $node->filter('.products')) ? trim($n->text()) : null, sprintf('%s%s', count($n = $node->filter('.top img')) ? trim($n->attr('alt')) : null, count($n = $node->filter('.him_icon img')) ? trim($n->attr('alt')) : null)), function ($v) {
return $v !== null;
});
});
// Combine overviews
$_overviews = array();
for ($i = 0; $i < count($overviews) / 2; $i++) {
$overview = $overviews[$i * 2] + $overviews[$i * 2 + 1];
ksort($overview);
$_overviews[] = array_combine(array('date', 'departure', 'arrival', 'duration', 'change', 'product', 'infos'), $overview);
}
return $_overviews;
}
作者:xxdavi
项目:jaroska-ap
/**
* @param $html
* @return \Jaroska\Employees\Employee
*/
public function parse($html)
{
$crawler = new Crawler($html);
$content = $crawler->filter('.content')->first();
$employee = new Employee();
$employee->name = $content->filter('h1')->first()->text();
$list = $content->filter('ul > li');
$employee->otherInfo = $list->each(function (Crawler $item) {
return $item->text();
});
$node = $content->filter('ul')->getNode(0);
while ($node->nextSibling) {
$node = $node->nextSibling;
if (strpos($node->nodeValue, 'E-mail')) {
$employee->email = $this->parseEmail($node->nodeValue);
}
if (strpos($node->nodeValue, 'Telefon')) {
$employee->telephone = $this->parseTelephone($node->nodeValue);
}
if (strpos($node->nodeValue, 'Web')) {
$employee->website = $node->nextSibling->attributes->getNamedItem('href')->nodeValue;
}
}
$image = $content->filter('img');
if (count($image)) {
$employee->image = $image->first()->attr('src');
}
return $employee;
}
作者:TomKit
项目:Axo
/**
* @param string $rawResponse
*
* @return Torrent[]
*/
protected function transformResponse($rawResponse)
{
$crawler = new Crawler(gzdecode($rawResponse));
return $crawler->filter('tr[id^="torrent_"]')->each(function ($node) {
$magnet = $node->filter('.ka-magnet')->parents()->attr('href');
preg_match('/btih:([0-9A-Za-z]+)&/', $magnet, $matches);
$hash = $matches[1];
$size = $node->filter('td.nobr')->text();
preg_match('/([0-9\\.]+) ([A-Za-z]+)/', $size, $matches);
$size = $matches[1];
$unit = $matches[2];
$converter = new Nomnom($size);
$torrent = new Torrent();
$torrent->setName($node->filter('a.cellMainLink')->text());
$torrent->setHash($hash);
$torrent->setMagnet($magnet);
if ($unit == 'KB') {
$unit = 'kB';
}
$torrent->setSize($converter->from($unit)->to('B'));
$torrent->setSeeds($node->filter('td.green')->text());
$torrent->setPeers($node->filter('td.red')->text());
return $torrent;
});
}
作者:johannesponade
项目:Onepage
public function show()
{
$options = Config::get('onepager.options');
$progressBar = Cache::get('progressBar', function () {
$c = curl_init('https://www.startnext.com/sanktionsfrei/widget/?w=200&h=300&l=de');
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
$html = curl_exec($c);
if (curl_error($c)) {
die(curl_error($c));
}
$status = curl_getinfo($c, CURLINFO_HTTP_CODE);
curl_close($c);
$percent = 0;
if ($status == 200) {
$crawler = new Crawler();
$crawler->addHTMLContent($html, 'UTF-8');
// get the percentage for the progressbar
$styleString = $crawler->filter('.bar.bar-1')->attr('style');
$stringArray = explode(':', $styleString);
$percent = substr($stringArray[1], 0, -2);
// get the text for the progressbar
$textArray = $crawler->filter('.status-text span')->extract(['_text']);
}
return ['percent' => $percent, 'progressText' => $textArray[0]];
}, 5);
return view('home', ['options' => $options, 'percent' => $progressBar['percent'], 'progressText' => $progressBar['progressText']]);
}
作者:Strontium-9
项目:Syliu
/**
* @Given /^I select the "([^""]*)"$/
*/
public function iSelectThe($id)
{
$html = $this->getSession()->getPage()->getHtml();
$crawler = new Crawler($html);
$element = $crawler->filter('#' . $id)->first();
$element->addHtmlContent('checked');
}