{"id":23,"date":"2020-05-26T23:00:54","date_gmt":"2020-05-26T23:00:54","guid":{"rendered":"https:\/\/speedloger.com\/?p=23"},"modified":"2020-05-29T17:59:48","modified_gmt":"2020-05-29T08:59:48","slug":"php%e3%81%a7instagram-basic-display-api%e3%81%8b%e3%82%89curl%e3%81%a7%e3%83%a1%e3%83%87%e3%82%a3%e3%82%a2%e3%82%927%e4%bb%b6%e5%8f%96%e5%be%97%e3%81%97%e3%81%a6%e8%a6%81%e7%b4%a0%e3%82%92%e5%90%90","status":"publish","type":"post","link":"https:\/\/speedloger.com\/?p=23","title":{"rendered":"PHP\u3067Instagram Basic Display API\u304b\u3089cURL\u3067\u30e1\u30c7\u30a3\u30a2\u3092\u4efb\u610f\u306e\u4ef6\u6570\u53d6\u5f97\u3057\u3066li\u8981\u7d20\u3092\u51fa\u529b\u3059\u308b"},"content":{"rendered":"<h1>FB\u30a2\u30d7\u30ea\u306e\u4f5c\u6210\u304b\u3089\u30c8\u30fc\u30af\u30f3\u306e\u53d6\u5f97\u307e\u3067<\/h1>\n<h2>\u57fa\u672c\u65b9\u91dd<\/h2>\n<p>\u57fa\u672c\u7684\u306b\u4e0b\u8a18\u306e\u30b9\u30bf\u30fc\u30c8\u30ac\u30a4\u30c9\u306b\u6e96\u3058\u308b<br \/>\n<a href=\"https:\/\/developers.facebook.com\/docs\/instagram-basic-display-api\/getting-started\" title=\"Instagram\u57fa\u672c\u8868\u793aAPI\u30b9\u30bf\u30fc\u30c8\u30ac\u30a4\u30c9\">Instagram\u57fa\u672c\u8868\u793aAPI\u30b9\u30bf\u30fc\u30c8\u30ac\u30a4\u30c9<\/a><\/p>\n<p>\u4ee5\u4e0b\u3001\u5404\u5de5\u7a0b\u306e\u6ce8\u610f\u70b9\u306e\u307f<\/p>\n<h3>\u30b9\u30c6\u30c3\u30d71:Facebook\u30a2\u30d7\u30ea\u3092\u4f5c\u6210\u3059\u308b<\/h3>\n<p>\u4efb\u610f\u306e\u540d\u524d\u3067\u30a2\u30d7\u30ea\u3092\u4f5c\u6210\u3057\u305f\u3089<br \/>\n\u8a2d\u5b9a &gt; \u30d9\u30fc\u30b7\u30c3\u30af\u304b\u3089\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u300c\u30a6\u30a7\u30d6\u30b5\u30a4\u30c8\u300d\u3092\u8ffd\u52a0<br \/>\n<img src=\"https:\/\/i0.wp.com\/speedloger.com\/wp-content\/uploads\/2020\/05\/image-1590735703868.png?w=900&#038;ssl=1\" alt=\"file\" data-recalc-dims=\"1\" \/><\/p>\n<p><img src=\"https:\/\/i0.wp.com\/speedloger.com\/wp-content\/uploads\/2020\/05\/image-1590735805660.png?w=900&#038;ssl=1\" alt=\"file\" data-recalc-dims=\"1\" \/><\/p>\n<p><img src=\"https:\/\/i0.wp.com\/speedloger.com\/wp-content\/uploads\/2020\/05\/image-1590735889417.png?w=900&#038;ssl=1\" alt=\"file\" data-recalc-dims=\"1\" \/><\/p>\n<h3>\u30b9\u30c6\u30c3\u30d72:Instagram\u57fa\u672c\u8868\u793a\u3092\u69cb\u6210\u3059\u308b<\/h3>\n<p>\u30d7\u30ed\u30c0\u30af\u30c8\u3001Instagram\u3092\u8ffd\u52a0\u3057\u3001Basic Disply\u3092Create new App\u3059\u308b<br \/>\n<img src=\"https:\/\/i0.wp.com\/speedloger.com\/wp-content\/uploads\/2020\/05\/image-1590735981772.png?w=900&#038;ssl=1\" alt=\"file\" data-recalc-dims=\"1\" \/><\/p>\n<p><img src=\"https:\/\/i0.wp.com\/speedloger.com\/wp-content\/uploads\/2020\/05\/image-1590736239204.png?w=900&#038;ssl=1\" alt=\"file\" data-recalc-dims=\"1\" \/><\/p>\n<p>\u30ea\u30c0\u30a4\u30ec\u30af\u30c8URL\u95a2\u9023\u306e\u8a2d\u5b9a<br \/>\n\u4ee5\u4e0b\u306b\u8a2d\u5b9a\u3059\u308bURL\u306f\u3044\u3063\u305f\u3093\u540c\u4e00\u306b\u3057\u3066\u304a\u304f<\/p>\n<ul>\n<li>\u6709\u52b9\u306aOAuth\u30ea\u30c0\u30a4\u30ec\u30af\u30c8URI<\/li>\n<li>\u30b3\u30fc\u30eb\u30d0\u30c3\u30afURL\u306e\u8a31\u53ef\u306e\u53d6\u308a\u6d88\u3057<\/li>\n<li>\u30c7\u30fc\u30bf\u524a\u9664\u30ea\u30af\u30a8\u30b9\u30c8\u30b3\u30fc\u30eb\u30d0\u30c3\u30afURL<\/li>\n<\/ul>\n<h3>\u30b9\u30c6\u30c3\u30d73:Instagram\u30c6\u30b9\u30c8\u30e6\u30fc\u30b6\u30fc\u3092\u8ffd\u52a0\u3059\u308b<\/h3>\n<p>\u5f79\u5272 &gt; \u30a4\u30f3\u30b9\u30bf\u30b0\u30e9\u30e0\u30c6\u30b9\u30bf\u30fc\u3092\u8ffd\u52a0 \u304b\u3089<br \/>\n<img src=\"https:\/\/i0.wp.com\/speedloger.com\/wp-content\/uploads\/2020\/05\/image-1590737265252.png?w=900&#038;ssl=1\" alt=\"file\" data-recalc-dims=\"1\" \/><\/p>\n<p><img src=\"https:\/\/i0.wp.com\/speedloger.com\/wp-content\/uploads\/2020\/05\/image-1590737289370.png?w=900&#038;ssl=1\" alt=\"file\" data-recalc-dims=\"1\" \/><\/p>\n<h4>Instagram\u30a2\u30ab\u30a6\u30f3\u30c8\u5074\u306e\u8a2d\u5b9a<\/h4>\n<p>\u65b0\u3057\u3044\u30a6\u30a7\u30d6\u30d6\u30e9\u30a6\u30b6\u30fc\u3092\u958b\u304d\u3001www.instagram.com\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u3001\u5148\u307b\u3069\u62db\u5f85\u3057\u305fInstagram\u30a2\u30ab\u30a6\u30f3\u30c8\u306b\u30ed\u30b0\u30a4\u30f3\u3057\u307e\u3059\u3002(\u30d7\u30ed\u30d5\u30a3\u30fc\u30eb\u30a2\u30a4\u30b3\u30f3) &gt; [\u30d7\u30ed\u30d5\u30a3\u30fc\u30eb\u3092\u7de8\u96c6] &gt; [\u30a2\u30d7\u30ea\u3068\u30a6\u30a7\u30d6\u30b5\u30a4\u30c8] &gt; [\u30c6\u30b9\u30bf\u30fc\u306e\u62db\u5f85]\u306b\u79fb\u52d5\u3057\u3001\u62db\u5f85\u3092\u53d7\u3051\u5165\u308c\u307e\u3059\u3002<\/p>\n<h3>\u30b9\u30c6\u30c3\u30d74:\u30c6\u30b9\u30c8\u30e6\u30fc\u30b6\u30fc\u3092\u8a8d\u8a3c\u3059\u308b<\/h3>\n<p>Instagram\u5074\u306e\u30d6\u30e9\u30a6\u30b6\u3067\u4ee5\u4e0b\u3092\u958b\u304f<\/p>\n<pre><code>https:\/\/api.instagram.com\/oauth\/authorize\n  ?client_id={app-id}\n  &amp;redirect_uri={redirect-uri}\n  &amp;scope=user_profile,user_media\n  &amp;response_type=code<\/code><\/pre>\n<p><img src=\"https:\/\/i0.wp.com\/i.gyazo.com\/9fbef678f460c7ac64daa95482c95495.png?w=900&#038;ssl=1\" alt=\"file\" data-recalc-dims=\"1\" \/><\/p>\n<p>\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3055\u308c\u305fURL\u3092\u30e1\u30e2\u5e33\u306b\u30b3\u30d4\u30fc\u3001\u53d6\u5f97\u3067\u304d\u305f\u30b3\u30fc\u30c9\u3092\u8a18\u9332\u3057\u3066\u304a\u304f<br \/>\n\u4f75\u305b\u3066\u300c#_\u300d\u304c\u30ea\u30c0\u30a4\u30ec\u30af\u30c8URI\u306e\u672b\u5c3e\u306b\u8ffd\u52a0\u3055\u308c\u3066\u3044\u307e\u3059\u304c\u3001\u3053\u308c\u306f\u4e0d\u8981\u306a\u306e\u3067\u524a\u9664\u3057\u3066\u304a\u304f<\/p>\n<h3>\u30b9\u30c6\u30c3\u30d75:\u30c8\u30fc\u30af\u30f3\u3092\u53d6\u5f97\u3059\u308b\u305f\u3081\u306b\u30b3\u30fc\u30c9\u3092\u4ea4\u63db\u3059\u308b<\/h3>\n<p>\u203b\u300c\\\u300d\u306f\u30bf\u30fc\u30df\u30ca\u30eb\u306b\u304a\u3051\u308b\u6539\u884c\u3092\u610f\u5473\u3059\u308b<\/p>\n<pre><code>curl -X POST \\ https:\/\/api.instagram.com\/oauth\/access_token \\\n-F client_id={app-id} \\\n-F client_secret={app-secret} \\\n-F grant_type=authorization_code \\\n-F redirect_uri={redirect-uri} \\\n-F code={code}<\/code><\/pre>\n<h1>\u30c8\u30fc\u30af\u30f3\u306e\u5ef6\u9577<\/h1>\n<pre><code>https:\/\/graph.instagram.com\/access_token\n ?grant_type=ig_exchange_token\n &amp;client_secret={instagram-app-secret}\n &amp;access_token={short-lived-access-token}\n<\/code><\/pre>\n<h1>\u30e1\u30c7\u30a3\u30a2\u30c7\u30fc\u30bf\u306e\u53d6\u5f97<\/h1>\n<h2>\u3068\u308a\u3042\u3048\u305a\u30b3\u30fc\u30c9\u8cbc\u308a\u4ed8\u3051\u3066\u307f\u308b<\/h2>\n<p>\u30c8\u30fc\u30af\u30f3\u306b\u3064\u3044\u3066\u306f\u3044\u308d\u3044\u308d\u89e3\u8aac\u3057\u3066\u3044\u308b\u3068\u3053\u308d\u304c\u3042\u308b\u306e\u3067\u4e00\u65e6\u7701\u304d\u307e\u3059\u3002<br \/>\n\u30b9\u30fc\u30d1\u30fc\u9069\u5f53\u306a\u5b9f\u8a3c\u30b3\u30fc\u30c9\u306a\u3093\u3067\u3042\u3068\u306f\u304c\u3093\u3070\u3063\u3066\u304f\u3060\u3055\u3044<br \/>\n\u30c8\u30fc\u30af\u30f3\u306e\u66f4\u65b0\u51e6\u7406\u306f\u305d\u306e\u3046\u3061\u66f8\u304f\u4e88\u5b9a<\/p>\n<pre><code>&lt;?php\n$url = &quot;https:\/\/graph.instagram.com\/me\/media?fields=id,media_type,media_url,permalink,thumbnail_url&amp;access_token={access-token}&amp;limit={\u6b32\u3057\u3044\u4ef6\u6570}&quot;;\n$ch = curl_init(); \/\/ 1. \u521d\u671f\u5316\ncurl_setopt( $ch, CURLOPT_URL, $url ); \/\/ 2. \u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u8a2d\u5b9a\ncurl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );\n$result = curl_exec( $ch ); \/\/ 3. \u5b9f\u884c\u3057\u3066\u30c7\u30fc\u30bf\u3092\u5f97\u308b\ncurl_close($ch); \/\/ 4. \u7d42\u4e86\n\n$array = json_decode( $result, true );\n                for ( $i = 0; $i &lt; count( $array[ &quot;data&quot; ] ); $i++ ) {\n                    if($array[ &quot;data&quot; ][ $i ][ &quot;media_type&quot; ] == &quot;VIDEO&quot;){\n                        $standardResolution = $array[ &quot;data&quot; ][ $i ][ &quot;thumbnail_url&quot; ];\n                    }else{\n                        $standardResolution = $array[ &quot;data&quot; ][ $i ][ &quot;media_url&quot; ];                        \n                    }\n                    $post_url = $array[ &quot;data&quot; ][ $i ][ &quot;permalink&quot; ];\n\n                    echo &#039;&lt;li&gt;&lt;a href=&quot;&#039;.$post_url.&#039;&quot; target=&quot;_blank&quot; &gt;&lt;img src=&quot;&#039;.$standardResolution.&#039;&quot; width=&quot;176&quot; height=&quot;117&quot;&gt;&lt;\/a&gt;&lt;\/li&gt;&#039;;\n\n                }\n\n\/\/echo $result;\n?&gt;\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>FB\u30a2\u30d7\u30ea\u306e\u4f5c\u6210\u304b\u3089\u30c8\u30fc\u30af\u30f3\u306e\u53d6\u5f97\u307e\u3067 \u57fa\u672c\u65b9\u91dd \u57fa\u672c\u7684\u306b\u4e0b\u8a18\u306e\u30b9\u30bf\u30fc\u30c8\u30ac\u30a4\u30c9\u306b\u6e96\u3058\u308b Instagram\u57fa\u672c\u8868\u793aAPI\u30b9\u30bf\u30fc\u30c8\u30ac\u30a4\u30c9 \u4ee5\u4e0b\u3001\u5404\u5de5\u7a0b\u306e\u6ce8\u610f\u70b9\u306e\u307f \u30b9\u30c6\u30c3\u30d71:Facebook\u30a2\u30d7\u30ea\u3092\u4f5c\u6210\u3059\u308b \u4efb\u610f\u306e\u540d\u524d\u3067&#8230; &raquo; <a class=\"read-more-link\" href=\"https:\/\/speedloger.com\/?p=23\">read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":""},"categories":[3,4],"tags":[],"aioseo_notices":[],"jetpack_featured_media_url":"","uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"mynote-thumbnail":false,"mynote-medium":false},"uagb_author_info":{"display_name":"\u7ba1\u7406\u30a2\u30ab\u30a6\u30f3\u30c8","author_link":"https:\/\/speedloger.com\/?author=1"},"uagb_comment_info":0,"uagb_excerpt":"FB\u30a2\u30d7\u30ea\u306e\u4f5c\u6210\u304b\u3089\u30c8\u30fc\u30af\u30f3\u306e\u53d6\u5f97\u307e\u3067 \u57fa\u672c\u65b9\u91dd \u57fa\u672c\u7684\u306b\u4e0b\u8a18\u306e\u30b9\u30bf\u30fc\u30c8\u30ac\u30a4\u30c9\u306b\u6e96\u3058\u308b Instagram\u57fa\u672c&hellip;","_links":{"self":[{"href":"https:\/\/speedloger.com\/index.php?rest_route=\/wp\/v2\/posts\/23"}],"collection":[{"href":"https:\/\/speedloger.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/speedloger.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/speedloger.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/speedloger.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=23"}],"version-history":[{"count":0,"href":"https:\/\/speedloger.com\/index.php?rest_route=\/wp\/v2\/posts\/23\/revisions"}],"wp:attachment":[{"href":"https:\/\/speedloger.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=23"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/speedloger.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=23"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/speedloger.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=23"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}