Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to retrieve URL report URL for download #53

Merged
merged 1 commit into from
Dec 1, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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