• Resolved owenpiccirillo

    (@owenpiccirillo)


    Hello,

    I have been using a php script I made with access token that displays the latest instagram pics on my site.

    However starting a week ago, instagram is either crashing or servers are having issues, and now my website “hangs” for 10 seconds before it loads up trying to retrieve the data… it works but the website takes way to long to load up.

    here is the code..

    <?php

    function linkify_instagram($status_text){

    $status_text = preg_replace(
    ‘/(https?:\/\/\S+)/’,
    \1‘,
    $status_text
    );

    $status_text = preg_replace(
    ‘/(^|\s)@(\w+)/’,
    ‘\1@\2‘,
    $status_text
    );

    return $status_text;
    }

    $url = “https://api.instagram.com/v1/users/XXXXXXXX/media/recent?count=8&access_token=XXXXXXXXXXXXX&#8221;;

    if ( isset($_GET[“next_max_id”]) ) {
    $url .= “&max_id=” . $_GET[“next_max_id”];
    }

    $data = json_decode(file_get_contents($url));

    $arr = (array)$data->data;

    for ( $i=0; $i<count($arr); $i++ ) {

    if($i<12){
    $post = $arr[$i];

    $postEdited = $post->images->standard_resolution->url;
    ?>

    <div class=”insta-square” >
    <div class=”insta-post” style=”background-image: url(<?= $postEdited ?>)”>link; ?>” target=”_blank”>/img/instagram-clear.png”></div><div class=”clr”></div>
    </div>

    <?php }} ?>

    Another website I have uses your plugin, and it pops right up, even without the access token!

    I was trying to look at the plugin raw code but was unable to decipher it…. do you have any examples or documentation of just the raw code working by just changing out the username? ( not wordpress site )

    I would appreciate it!

    Thanks
    -O

Viewing 1 replies (of 1 total)
  • Plugin Author Scott (@scottsweb)

    (@scottsweb)

    I am sorry but this is far outside the scope of this support forum.

    The scrape_instagram function should be fairly portable but it relies on WordPress caching functions.

Viewing 1 replies (of 1 total)
  • The topic ‘Can you supply code without using it with wordpress?’ is closed to new replies.