WordPress.org

Ready to get started?Download WordPress

Forums

Pretty Link Lite
[resolved] [Plugin: Pretty Link] Workaround for CURLOPT_FOLLOWLOCATION error (1 post)

  1. Dave Ross
    Member
    Posted 3 years ago #

    The CURLOPT_FOLLOWLOCATION option was causing an error to display because of how MediaTemple is locking things down. Added a clause to use file_get_contents() with an URL wrapper if they're enabled. Thought I'd suggest it as an option.

    In PrliUrlUtils.php:

    function curl_read_remote_file($url)
      {
      	if(ini_get('allow_url_fopen')) {
      		$data = file_get_contents($url);
      		return $data;
      	}
        else if(function_exists('curl_init'))
        {
          $ch = curl_init();
    
          curl_setopt($ch, CURLOPT_URL, $url);
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
          curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
          curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    
          $data = curl_exec($ch);
    
          curl_close($ch);
    
          return $data;
        }
    
        return false;
      }

    http://wordpress.org/extend/plugins/pretty-link/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic