php - Get image with curl via https -
i have script gets image http , works fine, when try image https link not working. using curl, , have found get image via https , php not working.
my code:
$image_url="https://ssl.gstatic.com/accounts/services/mail/phone.png"; $slika = getsslpage($image_url); if(!empty($slika)) file_put_contents('vest.jpg', $slika); function getsslpage($url) { $ch = curl_init(); curl_setopt($ch, curlopt_ssl_verifypeer, false); curl_setopt($ch, curlopt_header, false); curl_setopt($ch, curlopt_followlocation, true); curl_setopt($ch, curlopt_ssl_verifyhost, false); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_referer, $url); curl_setopt($ch, curlopt_returntransfer, true); $result = curl_exec($ch); curl_close($ch); return $result; }
phpinfo giving me information
protocols: dict, file, ftp, gopher, http, imap, pop3, rtsp, smtp, telnet, tftp
and command line showing https
root@server [~]# curl --version curl 7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 nss/3.16.2.3 basic ecc zlib/1.2.3 libidn/1.18 libssh2/1.4.2 protocols: tftp ftp telnet dict ldap ldaps http file https ftps scp sftp
i have solved installing curl ssl
/scripts/easyapache option 7 on menu select php scroll down , select curl ssl exit save
everything working now
Comments
Post a Comment