From 67dcea674471af39e216441cc14dbe9c9dcf1aef Mon Sep 17 00:00:00 2001 From: Tomasz Muras Date: Tue, 13 Mar 2018 22:15:07 +0100 Subject: [PATCH] Add guzzle --- composer.json | 5 +++++ data/.gitkeep | 0 fetch.php | 18 ++++++++++++++++++ 3 files changed, 23 insertions(+) create mode 100644 composer.json create mode 100644 data/.gitkeep create mode 100644 fetch.php diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..3913318 --- /dev/null +++ b/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + "guzzlehttp/guzzle": "~6.0" + } +} diff --git a/data/.gitkeep b/data/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/fetch.php b/fetch.php new file mode 100644 index 0000000..aa71641 --- /dev/null +++ b/fetch.php @@ -0,0 +1,18 @@ + 2.0, +]); + +$url = ''; +$response = $client->get('$url'); +$body = $response->getBody(); +$content = $body->getContents(); +$sha = sha1($content); +if(!file_exists("data/$sha")) { + file_put_contents("data/$sha", $content); +} +$body->getSize(); \ No newline at end of file