-2

I have enabled OpenId for my website. However when I want to download and save the user avatars to my server, I can't. I have tried several methods but none of them worked. I should note that my script works just fine for http files so for example it will for THIS FILE but not for THIS URL. I know I can change https to http and download the image. But I wonder what should I do to download the file from https?

svick
  • 236,525
  • 50
  • 385
  • 514
Alireza Noori
  • 14,961
  • 30
  • 95
  • 179
  • 2
    We're gonna need more information, how you're fetching these images (curl, file_ge_contents), and, what's the error? Maybe it's some google limitation ... You can also access all picasa photos without https, just replace the https by http and fetch the image – StiveKnx Mar 10 '12 at 13:18
  • As I said, I have tried several methods, however the easiest one is `copy($url, $filename);` (which is working right now) – Alireza Noori Mar 10 '12 at 13:21
  • `copy` uses `file_get_contents` to download file, if you tried with curl and didn't work, check: http://stackoverflow.com/questions/316099/cant-connect-to-https-site-using-curl-returns-0-length-content-instead-what-c It's working now, but if for some reason it stops, try to use `fsockopen` – StiveKnx Mar 10 '12 at 13:25
  • _"I want to download [...] I can't"_. Please tell why not. What method do you use, and what errors do you get? – CodeCaster Mar 10 '12 at 14:01
  • @CodeCaster: As I said in the comments and the question itself, I've used a few methods such as the `copy` function, `file_get_contents`, `cURL` and any other method I found on the net. None of them worked. As for the first part of your question: `why not`, I don't know why not. That's the reason I asked the question. ;) – Alireza Noori Mar 10 '12 at 18:35

1 Answers1

1

What OS do you use? Make sure PHP is compiled with OpenSSL support. In some distributions you have to install a package like php-openssl for method like file_get_contents or cURL to work on SSL.

Jérôme Mahuet
  • 874
  • 8
  • 13