khromov / sitemap-cache-warmer

Visits pages based on a sitemap to keep your cache warm
103 stars 28 forks source link

Don't see json report after run #11

Closed toraonion closed 4 years ago

toraonion commented 4 years ago

Hi,

How can I config script to provide report after its run? On your description page, you mentioned that there will be a json output but after checking the script folder, I don't see any.

Where should I find it?

Thank you.

khromov commented 4 years ago

Hey @toraonion!

When you run the warm.php script, you will get a JSON string back with the report run.

For example, try this in your console and you should get a similar response. (You can omit everything after | if you don't have jq installed).

curl "https://example.com/cache-warmer/warm.php?key=123456&url=https://example.com/sitemap.xml" | jq "."
{
  "visited_urls": [
    "https://example.com/page/",
    ...
  ],
  "log": [
    "Processed sub-sitemap: https://example.com/post-sitemap.xml",
    "Processed sub-sitemap: https://example.com/page-sitemap.xml",
    "Processed sub-sitemap: https://example.com/product-sitemap.xml",
    "Processed sub-sitemap: https://example.com/category-sitemap.xml",
    "Processed sub-sitemap: https://example.com/product_cat-sitemap.xml",
    "Processed sub-sitemap: https://example.com/author-sitemap.xml"
  ],
  "duration": 5.5163090229034,
  "count": 30,
  "message": "Processed sitemap: https://example.com/sitemap_index.xml",
  "status": "OK"
}

If you get nothing back, make sure there are no errors in your PHP error log. Feel free to reopen if it still doesn't work for you.