Skip to content

Commit

Permalink
add save result option
Browse files Browse the repository at this point in the history
  • Loading branch information
Blake Bertuccelli-Booth committed Mar 4, 2024
1 parent dbc938f commit 073e712
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ function logMessage($message) {
echo "$message\n";
}

function saveResult($jobId, $data) {
$resultsDir = 'results'; // Ensure this directory exists and is writable
$filePath = $resultsDir . '/' . $jobId . '.json';
file_put_contents($filePath, json_encode($data, JSON_PRETTY_PRINT));
}

function checkSitemap($url) {
$sitemapUrl = rtrim($url, '/') . '/sitemap.xml';
$robotsTxtUrl = rtrim($url, '/') . '/robots.txt';
Expand Down Expand Up @@ -66,6 +60,13 @@ function checkSitemap($url) {
return false; // No sitemap found
}

function saveResult($jobId, $data) {
$resultsDir = 'results'; // Ensure this directory exists and is writable
$filePath = $resultsDir . '/' . $jobId . '.json';
file_put_contents($filePath, json_encode($data, JSON_PRETTY_PRINT));
}


function followRedirects($url) {
$headers = get_headers($url, 1);
if ($headers && strpos($headers[0], '200') !== false) {
Expand Down

0 comments on commit 073e712

Please sign in to comment.