Title: SSL error
Last modified: October 1, 2018

---

# SSL error

 *  [Anders Alhbin](https://wordpress.org/support/users/alhbin/)
 * (@alhbin)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/ssl-error-30/)
 * Hi, I get this error message trying to download images:
 * cURL Request Error:: SSL certificate problem: unable to get local issuer certificate.
 * The site is a staging site with no SSL, is this needed to be able to download?
   
   Hosted at Pressidium.
 * Thanks!
    -  This topic was modified 7 years, 8 months ago by [Anders Alhbin](https://wordpress.org/support/users/alhbin/).
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fssl-error-30%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * (@dcooney)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/ssl-error-30/#post-10739703)
 * Hi [@alhbin](https://wordpress.org/support/users/alhbin/),
    Can you have a look
   at this answer and let me know if this helps? [https://wordpress.org/support/topic/curl-error-unable-to-download-image-to-server/#post-10677859](https://wordpress.org/support/topic/curl-error-unable-to-download-image-to-server/#post-10677859)
 * It will mean modifying core code, but it would really help me try to contain 
   some of these errors that I can’t reproduce.
 *     ```
       curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
       curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
       ```
   
    -  This reply was modified 7 years, 8 months ago by [Darren Cooney](https://wordpress.org/support/users/dcooney/).
 *  Thread Starter [Anders Alhbin](https://wordpress.org/support/users/alhbin/)
 * (@alhbin)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/ssl-error-30/#post-10741917)
 * Hello!
 * OK, just to make sure I did it correct, I adjusted in the file “/wp-content/plugins/
   instant-images/api/upload.php” Correct place?
 * In such case, sorry – no difference. Same error message.
    Also please check below
   code so I did it correct.
 * BR // Anders
 *     ```
       // Confirm cURL is enabled
             if(in_array  ('curl', get_loaded_extensions())) {
   
                // Generate temp image from URL and store it on server for upload
                $ch = curl_init(); // Lets use cURL
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Anders added
                curl_setopt($ch, CURLOPT_BINARYTRANSFER,1); // Anders added
                curl_setopt($ch, CURLOPT_URL, $img);
                curl_setopt($ch, CURLOPT_HEADER, 0);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
                $picture = curl_exec($ch);            
   
                // cURL error
                if (curl_error($ch)) {
                   $response = array(
                		'error' => true,
                		'msg' => __('cURL Request Error:', 'instant-images') .': '. curl_error($ch),
                		'path' => '',
                		'filename' => ''
             		);
                }  
       ```
   
 *  Plugin Author [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * (@dcooney)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/ssl-error-30/#post-10742641)
 * [@alhbin](https://wordpress.org/support/users/alhbin/) I’m not seeing the `CURLOPT_SSL_VERIFYHOST`
   or `CURLOPT_SSL_VERIFYPEER` lines in your code sample. Looks like you added the
   wrong code.
 * Can you please try the following.
 *     ```
       // Confirm cURL is enabled
       if(in_array  ('curl', get_loaded_extensions())) {
   
       // Generate temp image from URL and store it on server for upload
       $ch = curl_init(); // Lets use cURL
       curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
       curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
       curl_setopt($ch, CURLOPT_URL, $img);
       curl_setopt($ch, CURLOPT_HEADER, 0);
       curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
       curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
       $picture = curl_exec($ch);            
   
       // cURL error
       if (curl_error($ch)) {
          $response = array(
       		'error' => true,
       		'msg' => __('cURL Request Error:', 'instant-images') .': '. curl_error($ch),
       		'path' => '',
       		'filename' => ''
       	);
       }  
       ```
   
 * Or copy replace the entire contents of upload.php with this gist.
    [https://gist.github.com/dcooney/f50f2d7e680be69887d566d3ea9551d8](https://gist.github.com/dcooney/f50f2d7e680be69887d566d3ea9551d8)
 *  Plugin Author [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * (@dcooney)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/ssl-error-30/#post-10742655)
 * Also [@alhbin](https://wordpress.org/support/users/alhbin/), can you possibly
   provide some server specs so I can try to replicate?
 * For example, what hosting environment are you using?
 *  Thread Starter [Anders Alhbin](https://wordpress.org/support/users/alhbin/)
 * (@alhbin)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/ssl-error-30/#post-10742754)
 * OK, so the new code is working better, sorry if I got the wrong one at first.
 * Then I got the permission error, but after changing permission from 341 to 755
   on the uploads/instant-images folder, this was also solved! So now it works 🙂
 * However a couple of questions: This code change you now gave me, will you include
   this in next version, or will it be overwritten, and do it cause any security
   problems using it? (As someone mentioned in another support thread…)
 * I am hosting all my and my clients sites on Pressidium, a dedicated WP hosting
   company. I guess I will have to do this manual permission change on all of the
   sites I now will use your plugin on? Is there then any risk of Pressidium changes
   this back again for some security reasons?
 * Thanks!
 *  Thread Starter [Anders Alhbin](https://wordpress.org/support/users/alhbin/)
 * (@alhbin)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/ssl-error-30/#post-10742762)
 * And by the way – If you need for testing, I can setup an account for you to work
   with on my Staging site, and also provide you with some FTP access to the same.
 *  Plugin Author [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * (@dcooney)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/ssl-error-30/#post-10742939)
 * I’m going to run tests on my environments to see if this affects anything, if
   not I’ll add it into the plugin.
 * > And by the way – If you need for testing, I can setup an account for you to
   > work with on my Staging site, and also provide you with some FTP access to 
   > the same.
 * Thanks – appreciate that! If I need it I’ll reach out 🙂

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘SSL error’ is closed to new replies.

 * ![](https://ps.w.org/instant-images/assets/icon-256x256.png?rev=2504172)
 * [Instant Images - One-click Image Uploads from Unsplash, Openverse, Pixabay, Pexels, and Giphy](https://wordpress.org/plugins/instant-images/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/instant-images/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/instant-images/)
 * [Active Topics](https://wordpress.org/support/plugin/instant-images/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/instant-images/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/instant-images/reviews/)

## Tags

 * [curl](https://wordpress.org/support/topic-tag/curl/)
 * [SSL](https://wordpress.org/support/topic-tag/ssl/)

 * 7 replies
 * 2 participants
 * Last reply from: [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * Last activity: [7 years, 8 months ago](https://wordpress.org/support/topic/ssl-error-30/#post-10742939)
 * Status: not resolved