Skip to content

Commit

Permalink
Merge pull request #53 from tegansnyder/feature/urlreporturl
Browse files Browse the repository at this point in the history
Add ability to retrieve URL report URL for download
  • Loading branch information
Swader authored Dec 1, 2016
2 parents 35fda89 + 694e21b commit 201c585
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/Api/Crawl.php
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,42 @@ public function buildUrl()
return $url;
}

/**
* Sets the request type to "urls" to retrieve the URL Report
* URL for understanding diagnostic data of URLs
*
* @return $this
*/
public function getUrlReportUrl($num = null)
{
$this->otherOptions['type'] = 'urls';

if (!empty($num) && is_numeric($num)) {
$this->otherOptions['num'] = $num;
}

// Setup data endpoint
$url = $this->apiUrl . '/data';

// Add token
$url .= '?token=' . $this->diffbot->getToken();

if ($this->getName()) {
// Add name
$url .= '&name=' . $this->getName();

// Add other options
if (!empty($this->otherOptions)) {
foreach ($this->otherOptions as $option => $value) {
$url .= '&' . $option . '=' . $value;
}
}
}

return $url;

}

/**
* @return string
*/
Expand Down

0 comments on commit 201c585

Please sign in to comment.