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

Allow for alternative temporary directory path #345

Closed
justcaldwell opened this issue Apr 11, 2020 · 2 comments
Closed

Allow for alternative temporary directory path #345

justcaldwell opened this issue Apr 11, 2020 · 2 comments

Comments

@justcaldwell
Copy link

Fantastic library - thank you!

I'm wondering if there is a way to provide an alternative path for temporary files. Using sys_get_temp_dir() can be problematic for users in environments with restrictions that prevent them writing to system directories. Specifically, line 84 in CurlDispatcher.php:

$cookies = str_replace('//', '/', sys_get_temp_dir().'/embed-cookies.txt');

In our case, Drupal maintains it's own temporary directory that can be different from the one returned by sys_get_temp_dir().

@oscarotero
Copy link
Owner

Ok, good idea.
I've added the ability to pass options to the CurlClient class. For example:

$client = new CurlClient();
$client->setSettings(['cookies_path' => $custom_cookies_path]);

$embed = new Embed(new Crawler($client));

Can you confirm this works fine before tag a new version?
Thanks.

@justcaldwell
Copy link
Author

Thanks very much for your responsiveness.
I just noticed that embed 4.0 requires PHP 7.4+. My Drupal dev environment only supports up to 7.3 at the moment -- as soon as I can bump it to 7.4, I'll give this a test. Apologies for the delay.

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

2 participants