WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [Plugin: WordPress Media Flickr] Fixed issue with file_get_contents (1 post)

  1. jeremyheslop
    Member
    Posted 6 years ago #

    I had an issue with the plugin because it was using file_get_contents (allow_url_fopen option in php.ini) which was turned off (blocked) by my hosting provider (1and1). I renamed the function to my_file_get_contents (on lines 31 and 35) and put this function at the top of the file wp-media-flickr.php:

    function my_file_get_contents($url) {
        $ch = curl_init();
        $timeout = 5; // set to zero for no timeout
        curl_setopt ($ch, CURLOPT_URL, $url);
        curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
        $file_contents = curl_exec($ch);
        curl_close($ch);
        return $file_contents;
    }

    I was then able to authenticate and properly use the plugin when adding a post. Thanks for a great plugin.

    Jeremy

Topic Closed

This topic has been closed to new replies.

About this Topic