Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1d3aeb1

Browse files
emptyset check and add proxy support
1 parent c34ae91 commit 1d3aeb1

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

‎src/Api/Crawl.php‎

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,19 @@ public function setObeyRobots($bool = true)
365365

366366
return $this;
367367
}
368+
369+
/**
370+
* Set value to 1 to force the use of proxy IPs for the crawl.
371+
*
372+
* @param bool $bool
373+
* @return $this
374+
*/
375+
public function setUseProxies($bool = true)
376+
{
377+
$this->otherOptions['useProxies'] = (int)(bool)$bool;
378+
379+
return $this;
380+
}
368381

369382
/**
370383
* Force the start of a new crawl "round" (manually repeat the crawl).
@@ -488,13 +501,17 @@ public function buildUrl()
488501
$url .= '&name=' . $this->getName();
489502

490503
// Add seeds
491-
$url .= '&seeds=' . implode('', array_map(function ($item) {
504+
if (!empty($this->seeds)) {
505+
$url .= '&seeds=' . implode('', array_map(function ($item) {
492506
return urlencode($item);
493507
}, $this->seeds));
508+
}
494509

495510
// Add other options
496-
foreach ($this->otherOptions as $option => $value) {
497-
$url .= '&' . $option . '=' . $value;
511+
if (!empty($this->otherOptions)) {
512+
foreach ($this->otherOptions as $option => $value) {
513+
$url .= '&' . $option . '=' . $value;
514+
}
498515
}
499516

500517
// Add API link

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /