Skip to content

Commit

Permalink
Add guzzle
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomasz Muras committed Mar 13, 2018
1 parent e12dc18 commit 67dcea6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"require": {
"guzzlehttp/guzzle": "~6.0"
}
}
Empty file added data/.gitkeep
Empty file.
18 changes: 18 additions & 0 deletions fetch.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
require 'vendor/autoload.php';

use GuzzleHttp\Client;

$client = new Client([
'timeout' => 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();

0 comments on commit 67dcea6

Please sign in to comment.