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

CURLOPT_HTTP_VERSION not working #134

Open
nguyenduytan opened this issue Nov 20, 2022 · 1 comment
Open

CURLOPT_HTTP_VERSION not working #134

nguyenduytan opened this issue Nov 20, 2022 · 1 comment

Comments

@nguyenduytan
Copy link

Dear,
I tried to use

->withOption('HTTP_VERSION', CURL_HTTP_VERSION_1_1) or ->withOption('HTTP_VERSION', 'CURL_HTTP_VERSION_1_1')

But seem it no effect. I tried with normal curl it work perfect.

@elimentz
Copy link
Contributor

elimentz commented Nov 21, 2022

According to the documentation, this is option should be set like this:

curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);

This is what the package documentation says:

You can add various cURL options to the request using of several utility methods 
such as withHeader() for adding a header to the request, or use the general 
withOption() method if no utility method applies. The package will automatically 
prepend the options with the CURLOPT_ prefix.

So try this in the package:

    $response = Curl::to('http://www.foo.com/bar')
        ->withData( array( 'foz' => 'baz' ) )
        ->withOption('HTTP_VERSION', CURL_HTTP_VERSION_1_1)
        ->get();

This should work just fine.

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