360, 'httpversion' => '1.1' ); $response = wp_remote_get('http://instagram.com/'.$instagramusername, $args); // Check for error if ( is_wp_error( $response ) ) { return; } if( is_array( $response ) ){ $insta_source = wp_remote_retrieve_body( $response ); // Check for error if ( is_wp_error( $insta_source ) ) { return; } $shards = explode('window._sharedData = ', $insta_source); $insta_json = explode(';', $shards[1]); $results_array = json_decode($insta_json[0], TRUE); // echo '
'; // print_r($results_array); // echo ''; if( is_array( $results_array ) && !empty( $results_array ) ){ //An example of where to go from there $latest_array = $results_array['entry_data']['ProfilePage'][0]['user']['media']['nodes']; if( is_array( $latest_array ) && !empty( $latest_array ) ){ echo '
';
esc_html_e('An Error Occured. Check your connection or make sure the username is exists', 'zeytin');
echo '';
}
}