source/php/Module/Social/Feed.php
public function parseInstagramMarkup($markup)
    {
        //Define what to get
        $startTag = '<script type="text/javascript">window._sharedData = ';
        $endTag   = ';</script>';

        //Match string with reguklar exp
        $hasMatch = preg_match(
                      "#" . preg_quote($startTag, "#")
                      . '(.*?)'
                      . preg_quote($endTag, "#")
                      . "#"
                      . 's', $markup, $matches);

        //Return matches (if valid json)
        if ($hasMatch && isset($matches[0])) {
            $matches = str_replace($startTag, "", $matches[0]);
            $matches = str_replace($endTag, "", $matches);

            return json_decode($matches);
        }

        //Nothing found, return false.
        return false;
    }
public function parseInstagramMarkup($markup)
    {
        //Define what to get
        $startTag = '<script type="text/javascript">window._sharedData = ';
        $endTag   = ';</script>';

        //Match string with reguklar exp
        $hasMatch = preg_match(
                      "#" . preg_quote($startTag, "#")
                      . '(.*?)'
                      . preg_quote($endTag, "#")
                      . "#"
                      . 's', $markup, $matches);

        //Return matches (if valid json)
        if ($hasMatch && isset($matches[0])) {
            $matches = str_replace($startTag, "", $matches[0]);
            $matches = str_replace($endTag, "", $matches);

            return json_decode($matches);
        }

        //Nothing found, return false.
        return false;
    }
public function parseInstagramMarkup ( $ markup ) { //Define what to get $ startTag = '<script type="text/javascript">window._sharedData = ' ; $ endTag = ';</script>' ; //Match string with reguklar exp $ hasMatch = preg_match ( "#" . preg_quote ( $ startTag , "#" ) . '(.*?)' . preg_quote ( $ endTag , "#" ) . "#" . 's' , $ markup , $ matches ) ; //Return matches (if valid json) if ( $ hasMatch && isset ( $ matches [ 0 ] ) ) { $ matches = str_replace ( $ startTag , "" , $ matches [ 0 ] ) ; $ matches = str_replace ( $ endTag , "" , $ matches ) ; return json_decode ( $ matches ) ; } //Nothing found, return false. return false ; }
Parse data recived
@param  $markup Raw data from webpage
@return Array with raw feed data
Parse data recived