从instagram加载图片网址 [英] load image url from instagram
问题描述
目前,我想从instagram网址获取图片.网址是这个
Currently i want to get image from instagram url. the url is this
https://www.instagram.com/p/B_zZCRpB895/media/?size=t
我现在正在做什么:
$image = file_get_contents("https://www.instagram.com/p/B_zZCRpB895/media/?size=t");
我将其运行到我的AWS服务器中,但结果是登录instagram.
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
......
但是,如果我在本地PC上运行的话.我可以显示图像代码.有什么方法可以从url instagram获取图像代码?
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?
推荐答案
它认为是因为这些链接旨在在instagram网站上提供内容.因此,如果您想在网站上显示图片,则必须使用instagram api:
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:
这是instagram api的入门链接.
Here is getting started link for instagram api.
在您还提供了身份验证令牌之后,您将最高兴地使用以下终结点: graph.facebook.com/{image id}
.
You will end most likly using this endpoint: graph.facebook.com/{image id}
after you have provided a authenication token too.
这篇关于从instagram加载图片网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!