简体   繁体   中英

load image url from instagram

Currently i want to get image from instagram url. the url is this

https://www.instagram.com/p/B_zZCRpB895/media/?size=t

what im doing now is this:

$image = file_get_contents("https://www.instagram.com/p/B_zZCRpB895/media/?size=t");

i run it into my AWS server, but the result is go to login instagram.

<!DOCTYPE html>\n
<html lang="en" class="no-js not-logged-in client-root">\n
    <head>\n
        <meta charset="utf-8">\n
        <meta http-equiv="X-UA-Compatible" content="IE=edge">\n
\n
        <title>\n
Login • Instagram\n
</title>\n
\n
        \n
        <meta name="robots" content="noimageindex, noarchive">\n
        <meta name="apple-mobile-web-app-status-bar-style" content="default">\n
        <meta name="mobile-web-app-capable" content="yes">\n
        <meta name="theme-color" content="#ffffff">\n
        <meta id="viewport" name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, viewport-fit=cover">\n
        <link rel="manifest" href="/data/manifest.json">\n
......

however, if i run into my local PC. i can display the image code. is there any way to get the image code from the url instagram?

It think it because these links are designed to serve content on instagram site. So if you want to display images on your site you have to use instagram api instead:

Here is getting started link for instagram api.

You will end most likly using this endpoint: graph.facebook.com/{image id} after you have provided a authenication token too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM