Skip to content

Commit 201c585

Browse files
authored
Merge pull request #53 from tegansnyder/feature/urlreporturl
Add ability to retrieve URL report URL for download
2 parents 35fda89 + 694e21b commit 201c585

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

src/Api/Crawl.php

+36
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,42 @@ public function buildUrl()
521521
return $url;
522522
}
523523

524+
/**
525+
* Sets the request type to "urls" to retrieve the URL Report
526+
* URL for understanding diagnostic data of URLs
527+
*
528+
* @return $this
529+
*/
530+
public function getUrlReportUrl($num = null)
531+
{
532+
$this->otherOptions['type'] = 'urls';
533+
534+
if (!empty($num) && is_numeric($num)) {
535+
$this->otherOptions['num'] = $num;
536+
}
537+
538+
// Setup data endpoint
539+
$url = $this->apiUrl . '/data';
540+
541+
// Add token
542+
$url .= '?token=' . $this->diffbot->getToken();
543+
544+
if ($this->getName()) {
545+
// Add name
546+
$url .= '&name=' . $this->getName();
547+
548+
// Add other options
549+
if (!empty($this->otherOptions)) {
550+
foreach ($this->otherOptions as $option => $value) {
551+
$url .= '&' . $option . '=' . $value;
552+
}
553+
}
554+
}
555+
556+
return $url;
557+
558+
}
559+
524560
/**
525561
* @return string
526562
*/

0 commit comments

Comments
 (0)