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

Private transparent proxy cache url download file really slow #68

Closed
polupraneeth opened this issue Sep 16, 2016 · 3 comments
Closed

Private transparent proxy cache url download file really slow #68

polupraneeth opened this issue Sep 16, 2016 · 3 comments

Comments

@polupraneeth
Copy link

Trying to download Private transparent proxy cache url with guzzle

I am trying to download a file from a file sharing website, but it really slows down the execution of the script. For large files it is giving me a time out error. I tried everything, but I'm still unable to download the cache URL files, as fast as it can be.
`use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;

use Kevinrob\GuzzleCache\CacheMiddleware;
use Doctrine\Common\Cache\ChainCache;
use Doctrine\Common\Cache\ArrayCache;
use Doctrine\Common\Cache\FilesystemCache;
use Kevinrob\GuzzleCache\Strategy\PrivateCacheStrategy;
use Kevinrob\GuzzleCache\Storage\DoctrineCacheStorage;

use GuzzleHttp\Psr7;
use GuzzleHttp\Cookie\FileCookieJar;

$current_dir = getcwd();
$temp_dir = "/temp/"; 
$cache_dir = "/cache/";

$stack = HandlerStack::create();
$stack->push(new CacheMiddleware(
new PrivateCacheStrategy(
new DoctrineCacheStorage(
new ChainCache([
new ArrayCache(),
new FilesystemCache($current_dir . $cache_dir),
])
)
)
), 'cache');


// Guzzle init
$cookieJar = new FileCookieJar($current_dir . $temp_dir .'jar.txt', true);
$client = new Client([
'defaults' => ['debug' => true],
'verify' => $current_dir . $temp_dir ."cacert.pem",
'handler' => $stack,
'cookies' => $cookieJar
]);

$download_file = "http://affix.is/mp3embed-1cg17i8ptsc8.mp3";
$resource = fopen($current_dir . $temp_dir ."temp.ext", 'w');
$response = $client->request('GET', $download_file, ['sink' => $resource]);
echo html_status($response);`
@Kevinrob
Copy link
Owner

Kevinrob commented Feb 4, 2017

Hi @polupraneeth, I don't realy understand what is your issue 😄. I'm not realy sure that this is related to this library.
I close this issue for the moment, if you need more help about that, don't hesitate to respond 😉.

@Kevinrob Kevinrob closed this as completed Feb 4, 2017
@josenobile
Copy link

Hello,

I think the problem is guzzle cache middleware does not support sink parameter. Does it support?

@Kevinrob
Copy link
Owner

Hi, how should it support sink parameter? Don't do caching?

@polupraneeth polupraneeth changed the title Private transparent proxy cache url downloaded the file really slow Private transparent proxy cache url download file really slow Mar 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants