load image url from instagram

有些话、适合烂在心里 提交于 2021-01-29 20:23:06

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/62538453/load-image-url-from-instagram

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!