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

file_get_contents not work with https #193

Closed
dem3trio opened this issue May 7, 2015 · 7 comments
Closed

file_get_contents not work with https #193

dem3trio opened this issue May 7, 2015 · 7 comments

Comments

@dem3trio
Copy link

dem3trio commented May 7, 2015

Hello,

i'm using sonata-media for symfony and it uses Buzz for downloading some files (for example, thumbnails images from youtube).

Youtube is now using https as default, and it makes file_get_contents crash.

The problem is in /lib/Buzz/Client/FileGetContents.php line 60

adding this line before:
$url = str_replace("https", "http", $url);

should fix this, but I don't know if its the better solution.

@stof
Copy link
Contributor

stof commented May 7, 2015

file_get_contents should work with https URLs as long as you have the openssl extension (and that it has the proper configuration for its CA file).
What is the error you are getting ?

@dem3trio
Copy link
Author

dem3trio commented May 7, 2015

file_get_contents(https://i.ytimg.com/vi/Tj75Arhq5ho/hqdefault.jpg): failed to open stream: operation failed

but if I try to use file_get_contents(http://i.ytimg.com/vi/Tj75Arhq5ho/hqdefault.jpg) it works

@dem3trio
Copy link
Author

dem3trio commented May 7, 2015

There is a related issue opened in sonata-media: sonata-project/SonataMediaBundle#759

@rande
Copy link

rande commented May 19, 2015

I found out the related issue. The capath must be set. See sonata-project/SonataMediaBundle#759 (comment)

@markusguenther
Copy link

I used a different client and that was a easy workaround for me. Curl is a bit better in such things.

    $browser = new Browser();
    $browser->setClient(new Curl());

Hope that helps some other guys too.

@poizon001
Copy link

poizon001 commented May 18, 2016

Hi,
I am using buzz browser to make patch call and getting the same error
file_get_contents(https://www.xyz.com/health/121.json): failed to open stream: operation failed.

I tried to use file_get_contents(http://www.xyz.com/health/121.json) still it does not works.

Please help

@Nyholm
Copy link
Collaborator

Nyholm commented Aug 7, 2017

Thank you @rande for explaining the problem and thanks @markusguenther for a workaround.

@poizon001, please see previous answers.

@Nyholm Nyholm closed this as completed Aug 7, 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

6 participants