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
cURL defaults #10509
Comments
Besides being hard to map stream context options to corresponding curl ones this would introduce backward compatibility issues.
Such function would be nice, but it has to go through RFC process Also related: https://wiki.php.net/rfc/curl_user_agent Currently you can keep default options in one handle and clone it instead of calling $defaultCh = curl_init();
curl_setopt($defaultCh, CURLOPT_PROXY, 'http://192.168.0.1:8080');
$ch = clone $defaultCh;
curl_setopt($ch, CURLOPT_URL, 'https://example.com');
curl_exec(); |
Sure, but it won't work for vendor packages. |
You can set the environment variables |
@adoy Your insight would also be helpful here. |
I have the same lecture and agree with @KapitanOczywisty. We shouldn't use the |
There has not been any recent activity in this feature request. It will automatically be closed in 14 days if no further action is taken. Please see https://github.com/probot/stale#is-closing-stale-issues-really-a-good-idea to understand why we auto-close stale feature requests. |
Up |
There has not been any recent activity in this feature request. It will automatically be closed in 14 days if no further action is taken. Please see https://github.com/probot/stale#is-closing-stale-issues-really-a-good-idea to understand why we auto-close stale feature requests. |
Still want to have |
@xepozz There is no point in keeping this issue alive, since you need to follow RFC process to make such changes. Are you willing to do that? |
@KapitanOczywisty yes I'd like to do it, but can't actually try. Give me a few weeks, I'll try to follow the process |
There has not been any recent activity in this feature request. It will automatically be closed in 14 days if no further action is taken. Please see https://github.com/probot/stale#is-closing-stale-issues-really-a-good-idea to understand why we auto-close stale feature requests. |
Description
The main problem is cURL doesn't have any default settings and an ability to set them.
So there is no way to control all your outgoing requests. Some reasons to control them globally: proxying, removing some unacceptable headers, encoding, etc.
fopen/file_get_contents/file are great to use shared configuration, but:
The following code:
I understand there are two different things, but global settings maybe incredible useful.
Due to cURL doesn't use streams, it would be great to have at least an additional method to set defaults.
So questions:
PHP Version
8.2
Operating System
No response
The text was updated successfully, but these errors were encountered: