WordPress.org

Ready to get started?Download WordPress

Forums

EP Hashimage
[resolved] Instragram 301 Error (fix suggestion) (3 posts)

  1. ndenitto
    Member
    Posted 2 years ago #

    Hey guys,

    So I think Instragram changed something with their links. When I noticed Instragram was not working, I investigated and sure enough: the old 'instragr.am' links REDIRECT to 'instagram.com'. Luckily, the second part of the link is the same. Let me tell you, CURL does NOT LIKE a redirect like that, though, and throws a 301 error. Your script then ignores the image.

    Pretty simple fix, though. Just modded the following function:

    private function _extractinstagram($link){
    		$link = trim($link);
    
    		$search = 'instagr.am';
    		$replace = 'instagram.com';
    
    		$link = str_replace( $search, $replace, $link );
    
    		$string = $this->_fetchurl($link);
    
    		if(isset($string)){
    			preg_match_all('!<img class="photo" src="(.*)" />!', $string, $matches);
    			if(isset($matches[1][0]) && !empty($matches[1][0])){
    				return $matches[1][0];
    			}
    		}
    	}

    http://wordpress.org/extend/plugins/ep-hashimage/

  2. Mattias
    Member
    Plugin Author

    Posted 2 years ago #

    Thanks for the information.

    The plugin has just been updated with your fix.

  3. ndenitto
    Member
    Posted 1 year ago #

    Just saw this. Cool! Glad to help.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags