/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<php /** * Copy File from HTTPS/SSL location * * @param string $FromLocation * @param string $ToLocation * @return boolean */ function copySecureFile($FromLocation,$ToLocation,$VerifyPeer=false,$VerifyHost=true) { // Initialize CURL with providing full https URL of the file location // Open file handle at the location you want to copy the file: destination path at local drive // Set CURL options // We are not sending any headers // Disable PEER SSL Verification: If you are not running with SSL or if you don't have valid SSL // Disable HOST (the site you are sending request to) SSL Verification, // if Host can have certificate which is nvalid / expired / not signed by authorized CA. // Execute CURL command // Close the CURL channel // Close file handle // return true if file download is successfull } // Function Usage if(copySecureFile("https://www.verisign.com/hp07/i/vlogo.gif","c:/verisign_logo.gif")) { echo 'File transferred successfully.'; } else { echo 'File transfer failed.'; } ?>
URL: http://blogs.digitss.com/php/php-downloading-a-file-from-secure-website-https-using-curl/