{"id":1494,"date":"2015-07-23T16:28:41","date_gmt":"2015-07-23T07:28:41","guid":{"rendered":"http:\/\/www.otwo.jp\/blog\/?p=1494"},"modified":"2018-07-27T14:45:52","modified_gmt":"2018-07-27T05:45:52","slug":"facebook_graphapi","status":"publish","type":"post","link":"https:\/\/www.otwo.jp\/blog\/facebook_graphapi\/","title":{"rendered":"graphAPI\u3092\u4f7f\u3063\u3066facebook\u306e\u6295\u7a3f\u3092\u8aad\u307f\u8fbc\u3080\u65b9\u6cd5"},"content":{"rendered":"<p>\u3053\u3093\u306b\u3061\u308f\u3002web\u30c7\u30b6\u30a4\u30ca\u30fc\u306e\u6c60\u7530\u3067\u3059\u3002<\/p>\n<p>\u5f0a\u793e\u3067\u306f\u30aa\u30ea\u30b8\u30ca\u30eb\u30ec\u30fc\u30d9\u30eb\u300c<a title=\"peakvox\" href=\"http:\/\/www.peakvox.com\/\" target=\"_blank\">peakvox<\/a>\u300d\u306b\u3066facebook\u3092\u904b\u7528\u3057\u3066\u3044\u308b\u306e\u3067\u3059\u304c\u3001<br \/>\n\u7a81\u7136facebook\u306e\u66f4\u65b0\u60c5\u5831\u304c\u53d6\u5f97\u3067\u304d\u306a\u304f\u306a\u308a\u3001\u3059\u3053\u3057\u30cf\u30de\u3063\u3066\u3057\u307e\u3063\u305f\u306e\u3067\u5171\u6709\u3055\u305b\u3066\u9802\u304d\u307e\u3059\u3002<br \/>\n\u540c\u3058\u73fe\u8c61\u306b\u304a\u60a9\u307f\u306e\u65b9\u306e\u53c2\u8003\u306b\u306a\u308c\u3070\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p><!--more--><\/p>\n<h1>\u4eca\u307e\u3067\u306e\u53d6\u5f97\u65b9\u6cd5<\/h1>\n<p>\u307e\u305a\u306f\u3001\u4eca\u307e\u3067\u3069\u306e\u3088\u3046\u306b\u53d6\u5f97\u3057\u3066\u3044\u305f\u304b\u3068\u3044\u3046\u3068\u3053\u308d\u3067\u3059\u304c\u3001<br \/>\n\u5f0a\u793e\u3067\u306fgoogleFeedApi\u3092\u4f7f\u3063\u3066facebook\u304c\u767a\u4fe1\u3057\u3066\u3044\u308bfeed\u60c5\u5831\u3092\u53d6\u5f97\u3057\u3066\u30bf\u30a4\u30e0\u30e9\u30a4\u30f3\u306e\u66f4\u65b0\u3092\u304a\u77e5\u3089\u305b\u3057\u3066\u304a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u3057\u304b\u3057\u3042\u308b\u65e5\u7a81\u7136\u30a8\u30e9\u30fc\u304c\u30fb\u30fb\u30fb\u3002<\/p>\n<p><strong>\u300c400:Feed could not be loaded.\u300d<\/strong><\/p>\n<p>\u8981\u3059\u308b\u306b\u30d5\u30a3\u30fc\u30c9\u304c\u8aad\u307f\u8fbc\u3081\u306a\u3044\u3088\u30fc\u3068\u8a00\u3063\u3066\u3044\u308b\u3088\u3046\u3067\u3059\u3002<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-1471\" src=\"http:\/\/www.otwo.jp\/blog\/wp-content\/uploads\/2015\/07\/image20150701_01.png\" alt=\"image20150701_01\" width=\"1000\" height=\"732\" srcset=\"https:\/\/www.otwo.jp\/blog\/wp-content\/uploads\/2015\/07\/image20150701_01.png 1000w, https:\/\/www.otwo.jp\/blog\/wp-content\/uploads\/2015\/07\/image20150701_01-300x219.png 300w\" sizes=\"(max-width: 1000px) 100vw, 1000px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>\u305d\u308c\u3082\u305d\u306e\u306f\u305a\u3001\u5b9f\u306ffacebook\u306efeed\u914d\u4fe1\u306e\u6a5f\u80fd\u304c2015\u5e746\u670823\u65e5\u3092\u3082\u3063\u3066\u7d42\u4e86\u3068\u306a\u3063\u3066\u3044\u307e\u3057\u305f\u3002<br \/>\n<a title=\"developers\" href=\"https:\/\/developers.facebook.com\/docs\/apps\/changelog#v2_3_90_day_deprecations\" target=\"_blank\">https:\/\/developers.facebook.com\/docs\/apps\/changelog#v2_3_90_day_deprecations<\/a><\/p>\n<blockquote><p>Page RSS Feed endpoint &#8211; at https:\/\/www.facebook.com\/feeds\/page.php is now deprecated and will stop returning data from June 23, 2015. Developers should call the Graph API&#8217;s \/v2.3\/{page_id}\/feed endpoint instead. This returns JSON rather than RSS\/XML.<\/p><\/blockquote>\n<p>\u3068\u3001\u3044\u3046\u3053\u3068\u3067\u5225\u306e\u65b9\u6cd5\u3067\u30bf\u30a4\u30e0\u30e9\u30a4\u30f3\u3092\u53d6\u5f97\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<h1>GraphAPI\u3092\u4f7f\u3063\u3066\u30bf\u30a4\u30e0\u30e9\u30a4\u30f3\u60c5\u5831\u3092\u53d6\u5f97\u3057\u3088\u3046<\/h1>\n<p>\u30a2\u30d7\u30ea\u306e\u767b\u9332\u3092\u3055\u308c\u3066\u3044\u308b\u524d\u63d0\u3067\u9032\u3081\u3066\u3044\u304d\u307e\u3059\u306e\u3067\u3001<br \/>\n1\u304b\u3089\u59cb\u3081\u308b\u65b9\u306f\u307e\u305a\u306f\u30a2\u30d7\u30ea\u306e\u767b\u9332\u3092\u3057\u3066AppID\u7b49\u53d6\u5f97\u3057\u3066\u304f\u3060\u3055\u3044\u306d\u3002<\/p>\n<p>\u305d\u308c\u3067\u306f\u5fc5\u8981\u306a\u60c5\u5831\u3092\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<h3>\u307e\u305a\u306fAppID\u3001APP_SECRET\u306e\u78ba\u8a8d<\/h3>\n<p><a title=\"apps\" href=\"https:\/\/developers.facebook.com\/apps\/\" target=\"_blank\">https:\/\/developers.facebook.com\/apps\/<\/a><br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-1473\" src=\"http:\/\/www.otwo.jp\/blog\/wp-content\/uploads\/2015\/07\/image20150701-2.png\" alt=\"image20150701-2\" width=\"721\" height=\"203\" srcset=\"https:\/\/www.otwo.jp\/blog\/wp-content\/uploads\/2015\/07\/image20150701-2.png 721w, https:\/\/www.otwo.jp\/blog\/wp-content\/uploads\/2015\/07\/image20150701-2-300x84.png 300w\" sizes=\"(max-width: 721px) 100vw, 721px\" \/><\/p>\n<h3>\u30a2\u30af\u30bb\u30b9\u30c8\u30fc\u30af\u30f3\u306e\u78ba\u8a8d\uff08\u53d6\u5f97\uff09<\/h3>\n<p><a title=\"accesstoken\" href=\"https:\/\/developers.facebook.com\/tools\/accesstoken\/\" target=\"_blank\">https:\/\/developers.facebook.com\/tools\/accesstoken\/<\/a><br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-1474\" src=\"http:\/\/www.otwo.jp\/blog\/wp-content\/uploads\/2015\/07\/image20150701-3_03.png\" alt=\"image20150701-3_03\" width=\"1002\" height=\"369\" srcset=\"https:\/\/www.otwo.jp\/blog\/wp-content\/uploads\/2015\/07\/image20150701-3_03.png 1002w, https:\/\/www.otwo.jp\/blog\/wp-content\/uploads\/2015\/07\/image20150701-3_03-300x110.png 300w\" sizes=\"(max-width: 1002px) 100vw, 1002px\" \/><\/p>\n<p>\u3082\u3057\u304f\u306f\u5148\u307b\u3069\u5165\u624b\u3057\u305f\u3001ID\u3068SECRET\u3092\u4f7f\u3063\u3066\u53d6\u5f97\u3057\u307e\u3057\u3087\u3046\u3002<br \/>\n\u4ee5\u4e0b\u306eURL\u3067\u3010\uff5e\u3011\u306f\u524a\u9664\u3057\u3001\u4ee3\u308f\u308a\u306bID\u3068SECRET\u3092\u5165\u308c\u3066\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068APP\u30a2\u30af\u30bb\u30b9\u30c8\u30fc\u30af\u30f3\u304c\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002<\/p>\n<blockquote><p>https:\/\/graph.facebook.com\/oauth\/access_token?client_id=<strong>\u3010APP_ID\u3011<\/strong>&amp;client_secret=<strong>\u3010APP_SECRET\u3011<\/strong>&amp;grant_type=client_credentials<\/p><\/blockquote>\n<h3>graphAPI\u3067json\u3092\u53d6\u5f97\u3057\u3066\u307f\u3088\u3046<\/h3>\n<p>\u3055\u3066\u3001\u6e96\u5099\u306f\u6574\u3044\u307e\u3057\u305f\u306d\uff01<br \/>\n\u305d\u308c\u3067\u306fjson\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u307e\u305a\u306ffacebook\u306eapi\u3092\u7c21\u5358\u306b\u5b9f\u884c\u3067\u304d\u308b\u30c4\u30fc\u30eb\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u305d\u308c\u3092\u4f7f\u3063\u3066json\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br \/>\n<a title=\"graphAPI\" href=\"https:\/\/developers.facebook.com\/tools\/explorer\" target=\"_blank\">facebook graph api explore<\/a><\/p>\n<p>\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u7a2e\u985e\u306f\u300cGET\u300d\u3001\u305d\u306e\u6a2a\u306e\u30c6\u30ad\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u306b\u306f\u3001\u53d6\u5f97\u3057\u305f\u3044\u30da\u30fc\u30b8\u306eappID\u3092\u5165\u529b\u3057\u307e\u3059\u3002<br \/>\n\u53d6\u5f97\u3057\u305f\u3044\u30da\u30fc\u30b8URL\u306ehttps:\/\/www.facebook.com\/<strong>peakvox<\/strong>\u306e\u672b\u5c3e\u90e8\u5206\u3067\u3059\u306d\u3002<br \/>\n\u4eca\u56de\u306ffeed\u60c5\u5831\u304c\u307b\u3057\u3044\u306e\u3067\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5165\u529b\u3057\u307e\u3059\u3002<\/p>\n<blockquote><p>https:\/\/graph.facebook.com\/v2.3\/peakvox\/feed<\/p><\/blockquote>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-1475\" src=\"http:\/\/www.otwo.jp\/blog\/wp-content\/uploads\/2015\/07\/image20150701-4_03.png\" alt=\"image20150701-4_03\" width=\"1055\" height=\"518\" srcset=\"https:\/\/www.otwo.jp\/blog\/wp-content\/uploads\/2015\/07\/image20150701-4_03.png 1055w, https:\/\/www.otwo.jp\/blog\/wp-content\/uploads\/2015\/07\/image20150701-4_03-300x147.png 300w, https:\/\/www.otwo.jp\/blog\/wp-content\/uploads\/2015\/07\/image20150701-4_03-1024x502.png 1024w\" sizes=\"(max-width: 1055px) 100vw, 1055px\" \/><\/p>\n<p>\u3044\u304b\u304c\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<p>\u53d6\u5f97\u304c\u3067\u304d\u306a\u3044\uff01\u3068\u3044\u3046\u65b9\u306f\u30a2\u30af\u30bb\u30b9\u306e\u8a31\u53ef\u304c\u3055\u308c\u3066\u3044\u306a\u3044\u53ef\u80fd\u6027\u304c\u3042\u308b\u306e\u3067\u3001<br \/>\n\u30c8\u30fc\u30af\u30f3\u306e\u66f4\u65b0\u3092\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>Get Token\u30dc\u30bf\u30f3\u306e\u4e2d\u306b\u3042\u308b\u300cGet Access Token\u300d\u3092\u30af\u30ea\u30c3\u30af\u3057\u3001\u8a31\u53ef\uff08\u53d6\u5f97\uff09\u3057\u305f\u3044\u60c5\u5831\u3092\u9078\u629e\u3057\u307e\u3059\u3002<br \/>\n\u4eca\u56de\u306f\u3001user_post\u306e\u307f\u3067\u5927\u4e08\u592b\u3067\u3059\u306d\u3002<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-1476\" src=\"http:\/\/www.otwo.jp\/blog\/wp-content\/uploads\/2015\/07\/8a4ae825d772a49f1e02a25324c28e4d.png\" alt=\"\u540d\u79f0\u672a\u8a2d\u5b9a-1_06\" width=\"550\" height=\"358\" srcset=\"https:\/\/www.otwo.jp\/blog\/wp-content\/uploads\/2015\/07\/8a4ae825d772a49f1e02a25324c28e4d.png 550w, https:\/\/www.otwo.jp\/blog\/wp-content\/uploads\/2015\/07\/8a4ae825d772a49f1e02a25324c28e4d-300x195.png 300w\" sizes=\"(max-width: 550px) 100vw, 550px\" \/><\/p>\n<p>GetAccessToken\u3092\u62bc\u3059\u3053\u3068\u3067\u66f4\u65b0\u3001submit\u3092\u62bc\u3057\u3066\u60c5\u5831\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<\/p>\n<p>\u4e0a\u8a18\u753b\u50cf\u306e\u3088\u3046\u306bJSON\u304c\u53d6\u5f97\u3067\u304d\u307e\u3057\u305f\u3067\u3057\u3087\u3046\u304b\uff1f<\/p>\n<h1>php\u3092\u4f7f\u3063\u3066\u30b5\u30a4\u30c8\u306b\u8868\u793a\u3057\u3066\u307f\u3088\u3046<\/h1>\n<p>\u305d\u308c\u3067\u306fjson\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3057\u3001\u30b5\u30a4\u30c8\u306b\u8868\u793a\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br \/>\njson\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u306b\u306f\u5148\u307b\u3069graphAPI\u3067\u78ba\u8a8d\u3057\u305fget\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u306b\u5165\u3063\u3066\u3044\u308bURL\u306b\u30a2\u30af\u30bb\u30b9\u30c8\u30fc\u30af\u30f3\u3092\u8db3\u3057\u305f\u3082\u306e\u3092\u5165\u308c\u307e\u3059\u3002<br \/>\n\u30a2\u30c9\u30ec\u30b9\u304c\u4e00\u90e8\u96a0\u308c\u3066\u3044\u308b\u5834\u5408\u306f\u30d5\u30a3\u30fc\u30eb\u30c9\u5185\u306e\u300c\u2192\u300d\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u3059\u3079\u3066\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<blockquote><p>https:\/\/graph.facebook.com\/v2.3\/<strong>\u3010APP_ID\u3011<\/strong>\/feed?access_token=<strong>\u3010APP_TOKEN\u3011<\/strong>;\n<\/p><\/blockquote>\n<p>\u4eca\u56de\u306e\u5834\u5408\u3001\u81ea\u793e\u30b5\u30a4\u30c8\u306b\u60c5\u5831\u3092\u8868\u793a\u3057\u305f\u3044\u3060\u3051\u306a\u306e\u3067UserToken\u3067\u306f\u306a\u304fAppToken\u3092\u4f7f\u3044\u307e\u3057\u3087\u3046\u3002<br \/>\nUserToken\u3068\u3044\u3046\u306e\u306fOAuth\u8a8d\u8a3c\u3057\u305f\u969b\u306b\u767a\u884c\u3055\u308c\u308b\u30e6\u30fc\u30b6\u30fc\u56fa\u6709\u306e\u30c8\u30fc\u30af\u30f3\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\nAppToken\u3068\u3044\u3046\u306e\u306ffacebook\u30a2\u30d7\u30ea\u56fa\u6709\u306e\u30c8\u30fc\u30af\u30f3\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u8a8d\u8a3c\u3092\u3057\u305f\u3046\u3048\u3067\u30e6\u30fc\u30b6\u30fc\u306e\u4ee3\u308f\u308a\u306b\u6295\u7a3f\u3057\u305f\u308a\u3059\u308b\u969b\u306fuserToken\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u304c\u3001<br \/>\n\u4eca\u56de\u306f\u81ea\u5206\u306e\u30a2\u30d7\u30ea\u304b\u3089\u60c5\u5831\u3092\u3082\u3089\u3046\u3060\u3051\u306a\u306e\u3067AppToken\u3092\u4f7f\u3046\u3068\u3044\u3046\u308f\u3051\u3067\u3059\u306d\u3002<br \/>\nUserToken\u306f\u3059\u3050\u306b\u6709\u52b9\u671f\u9650\u304c\u5207\u308c\u3066\u3057\u307e\u3044\u307e\u3059\u304c\uff08\u6700\u957760\u65e5\uff09\u3001AppToken\u306f\u6709\u52b9\u671f\u9650\u304c\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<h3>php\u3067\u53d6\u5f97\u3057\u3088\u3046<\/h3>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u4eca\u56de\u306e\u53d6\u5f97\u3001\u8868\u793a\u306e\u5185\u5bb9\u306f\u4ee5\u4e0b\u3068\u3057\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u305d\u308c\u3067\u306f\u3001\u4eca\u56de\u306f\u66f4\u65b0\u3055\u308c\u305f\u5185\u5bb9\u306e\u672c\u6587\u3068\u6295\u7a3f\u6642\u9593\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<\/li>\n<li>\u8a18\u4e8b\u3078\u306e\u30ea\u30f3\u30af\u306f\u4eca\u56de\u306fID\u3092\u5206\u5272\u3057\u3066url\u3092\u751f\u6210\u3059\u308b\u3053\u3068\u3068\u3057\u307e\u3059\u3002<\/li>\n<li>\u672c\u6587\u306e\u5185\u5bb9\u306f110\u6587\u5b57\u307e\u3067\u3067\u3001\u305d\u308c\u4ee5\u4e0a\u306f&#8221;&#8230;&#8221;\u3092\u8868\u793a\u3057\u7701\u7565\u3057\u307e\u3059\u3002<\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-1477\" src=\"http:\/\/www.otwo.jp\/blog\/wp-content\/uploads\/2015\/07\/image20150701-7.png\" alt=\"image20150701-7\" width=\"628\" height=\"514\" srcset=\"https:\/\/www.otwo.jp\/blog\/wp-content\/uploads\/2015\/07\/image20150701-7.png 628w, https:\/\/www.otwo.jp\/blog\/wp-content\/uploads\/2015\/07\/image20150701-7-300x245.png 300w\" sizes=\"(max-width: 628px) 100vw, 628px\" \/><br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-1478\" src=\"http:\/\/www.otwo.jp\/blog\/wp-content\/uploads\/2015\/07\/Graph-API-Explorer3.jpeg_01.png\" alt=\"Graph-API-Explorer3.jpeg_01\" width=\"628\" height=\"185\" srcset=\"https:\/\/www.otwo.jp\/blog\/wp-content\/uploads\/2015\/07\/Graph-API-Explorer3.jpeg_01.png 628w, https:\/\/www.otwo.jp\/blog\/wp-content\/uploads\/2015\/07\/Graph-API-Explorer3.jpeg_01-300x88.png 300w\" sizes=\"(max-width: 628px) 100vw, 628px\" \/><\/p>\n<pre class=\"brush: python\r; notranslate\">&lt;?php\r\n\r\n\/\/\u63a5\u7d9a\u60c5\u5831\r\ndefine('APP_ID', \"\u3010peakvox\u3011\");\r\ndefine('APP_TOKEN', \"\u3010appToken\u304c\u5165\u308a\u307e\u3059\u3011\");\r\n$url = \"https:\/\/graph.facebook.com\/v2.3\/\".APP_ID.\"\/feed?access_token=\".APP_TOKEN;\r\n\r\n\/\/json\u53d6\u5f97\r\n$ch = curl_init();\r\ncurl_setopt_array($ch,\r\n array(\r\n CURLOPT_URL =&gt; $url,\r\n CURLOPT_SSL_VERIFYPEER =&gt;false,\r\n CURLOPT_RETURNTRANSFER =&gt;true,\r\n )\r\n );\r\n$res = curl_exec($ch);\r\ncurl_close($ch);\r\n\r\n\/\/json\u6574\u5f62\r\n$array = json_decode($res, TRUE);\r\n\r\n$comment = array(); \/\/\u6295\u7a3f\u5185\u5bb9\u3092\u5165\u308c\u308b\u914d\u5217\u3067\u3059\r\n$times = array(); \/\/\u6295\u7a3f\u6642\u9593\u3092\u5165\u308c\u308b\u914d\u5217\u3067\u3059\r\n\r\nfor($i=0;$i&lt;3;$i++){\r\n \/\/\u8a18\u4e8b\u3078\u306e\u30ea\u30f3\u30af\u751f\u6210\u306e\u305f\u3081id\u3092\u53d6\u5f97\u3057\u3066\"_\"\u306e\u524d\u5f8c\u3067\u5206\u5272\u3057\u307e\u3059\u3002\r\n $urls = $array['data'][$i]['id'];\r\n $url_array = explode(\"_\", $urls);\r\n\r\n $times[$i] = substr($array['data'][$i]['created_time'], 0, strcspn($array['data'][$i]['created_time'],'T'));\r\n $comment[$i] = '&lt;a href=\"https:\/\/www.facebook.com\/'.$url_array[0].'\/posts\/'.$url_array[1].'\" target=\"_blank\"&gt;'.mb_strimwidth($array['data'][$i][\"message\"], 0, 110, \"...\").\"&lt;\/a&gt;\";\r\n}\r\n?&gt;\r\n\r\n\r\n\r\n&lt;html&gt;\r\n\r\n-----\u7701\u7565----- \r\n\r\n&lt;?php\r\n\r\n\/\/3\u4ef6\u8868\u793a\u3059\u308b\u307e\u3067\u30eb\u30fc\u30d7\u3067\u56de\u3057\u307e\u3059\r\nfor($i=0;$i&lt;3;$i++){\r\n?&gt;\r\n\r\n&lt;div class=\"inner\"&gt;\r\n &lt;p class=\"time\"&gt;&lt;?php echo $times[$i]; ?&gt;&lt;\/p&gt;\r\n &lt;p class=\"text\"&gt;&lt;?php echo $comment[$i] ?&gt;&lt;\/p&gt;\r\n&lt;\/div&gt;\r\n\r\n&lt;?php\r\n }\r\n?&gt;\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h3>\u5b9f\u884c\u7d50\u679c<\/h3>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.otwo.jp\/blog\/wp-content\/uploads\/2015\/07\/71fd03f3b73a9580fdfc81b8eba6eb20.jpeg\" alt=\"peakvox \u30d4\u30fc\u30af\u30dc\u30c3\u30af\u30b9\" width=\"452\" height=\"180\" class=\"alignnone size-full wp-image-1512\" srcset=\"https:\/\/www.otwo.jp\/blog\/wp-content\/uploads\/2015\/07\/71fd03f3b73a9580fdfc81b8eba6eb20.jpeg 452w, https:\/\/www.otwo.jp\/blog\/wp-content\/uploads\/2015\/07\/71fd03f3b73a9580fdfc81b8eba6eb20-300x119.jpeg 300w\" sizes=\"(max-width: 452px) 100vw, 452px\" \/><\/p>\n<p>json\u306e\u53d6\u5f97\u306e\u969b\u306ffile_get_contents\u95a2\u6570\u3092\u4f7f\u3063\u3066\u3082\u5927\u4e08\u592b\u3067\u3059\u3002<br \/>\n\u5f0a\u793e\u306e\u5834\u5408\u30b5\u30fc\u30d0\u30fc\u306eallow_url_fopen\u306e\u8a2d\u5b9a\u4e0ahttps\u3067\u306e\u53d6\u5f97\u304c\u3067\u304d\u307e\u305b\u3093\u306e\u3067<br \/>\n\u4eca\u56de\u306fcURL\u95a2\u6570\u3092\u4f7f\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<h3>\u8ffd\u8a18<\/h3>\n<p>\u5f8c\u65e5\u8ac7\u3067\u3059\u304c\u3001\u30d8\u30c3\u30c0\u30fc\u753b\u50cf\u306e\u5909\u66f4\u306a\u3069\u3067\u753b\u50cf\u306e\u307f\u6295\u7a3f\u3055\u308c\u305f\u5834\u5408\u306b\u7a7a\u306e\u30c7\u30fc\u30bf\u304c\u8868\u793a\u3055\u308c\u3066\u3057\u307e\u3063\u305f\u306e\u3067\u3001\u305d\u306e\u5bfe\u5fdc\u7b56\u3092\u8a18\u8f09\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: python\r; notranslate\">\/\/json\u6574\u5f62\r\n$array = json_decode($res, TRUE);\r\n\r\n$comment = array(); \/\/\u6295\u7a3f\u5185\u5bb9\u3092\u5165\u308c\u308b\u914d\u5217\u3067\u3059\r\n$times = array(); \/\/\u6295\u7a3f\u6642\u9593\u3092\u5165\u308c\u308b\u914d\u5217\u3067\u3059\r\n$display_cnt = 3; \/\/\u753b\u9762\u306b\u8868\u793a\u3057\u305f\u3044\u4ef6\u6570\u3067\u3059\r\n$i = 0; \/\/\u914d\u5217\u306e\u30c7\u30fc\u30bf\u4ef6\u6570\u3092\u5165\u308c\u308b\u5909\u6570\u3067\u3059\r\nforeach($array['data'] as $ary){\r\n  \/\/\u914d\u5217\u306b\"message\"\u306e\u30ad\u30fc\u304c\u3042\u308b\u304b\u3092\u78ba\u8a8d\r\n  if(array_key_exists('message',$ary) == false){\r\n    continue;\r\n  }\r\n  \/\/\u8868\u793a\u4ef6\u6570\u306b\u9054\u3057\u305f\u5834\u5408\u306f\u30eb\u30fc\u30d7\u304b\u3089\u629c\u3051\u308b\r\n  if($i >= $display_cnt){\r\n    break;\r\n  }\r\n\r\n  \/\/\u8a18\u4e8b\u3078\u306e\u30ea\u30f3\u30af\u751f\u6210\u306e\u305f\u3081id\u3092\u53d6\u5f97\u3057\u3066\"_\"\u306e\u524d\u5f8c\u3067\u5206\u5272\u3057\u307e\u3059\u3002\r\n  $urls = $ary['id'];\r\n  $url_array = explode(\"_\", $urls);\r\n  array_push($times,substr($ary['created_time'], 0, strcspn($ary['created_time'],'T')));\r\n  array_push($comment,'<a href=\"https:\/\/www.facebook.com\/'.$url_array[0].'\/posts\/'.$url_array[1].'\" target=\"_blank\">'.mb_strimwidth($ary[\"message\"], 0, 110, \"...\").\"<\/a>\");\r\n}\r\n<\/pre>\n<p>Facebook\u3078\u6295\u7a3f\u3057\u305f\u969b\u306e\u30b3\u30e1\u30f3\u30c8\u306f\u201dmessage\u201d\u3068\u8a00\u3046\u30ad\u30fc\u3067\u8fd4\u3063\u3066\u304d\u3066\u3044\u307e\u3057\u305f\u304c\u3001\u30b3\u30e1\u30f3\u30c8\u3092\u3057\u3066\u3044\u306a\u3044\u5834\u5408\u306f\u7a7a\u30c7\u30fc\u30bf\u3067\u306f\u306a\u304f\u3001\u30ad\u30fc\u81ea\u4f53\u304c\u3042\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002<br \/>\n\u3061\u306a\u307f\u306b\u3001$ary[\u2018message\u2019]==\u201d\u201d\u306e\u66f8\u304d\u65b9\u3060\u3068\u3001\u74b0\u5883\u306b\u3088\u3063\u3066\u306f\u30b3\u30e1\u30f3\u30c8\u304c\u306a\u3044\u5834\u5408\u306b\u8b66\u544a(\u201cNotice\u201d)\u304c\u8868\u793a\u3055\u308c\u3066\u3044\u307e\u3046\u53ef\u80fd\u6027\u304c\u3042\u308b\u305f\u3081\u3001\u30ad\u30fc\u306e\u30c1\u30a7\u30c3\u30af\u3067\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<h1>\u3055\u3044\u3054\u306b<\/h1>\n<p>\u3044\u304b\u304c\u3067\u3057\u305f\u304b\u3002<br \/>\nfacebook\u306f\u4ed5\u69d8\u5909\u66f4\u304c\u591a\u3044\u306e\u3067\u7a81\u7136\u52d5\u304b\u306a\u304f\u306a\u3063\u305f\uff01\u30a8\u30e9\u30fc\u304c\u51fa\u3066\u3044\u308b\uff01\u306a\u3093\u3066\u3053\u3068\u304c\u305f\u307e\u306b\u3042\u308a\u307e\u3059\u304c\u3001<br \/>\n\u4fbf\u5229\u306a\u30c4\u30fc\u30eb\u3067\u306f\u3042\u308b\u3068\u601d\u3044\u307e\u3059\u306e\u3067\u3001\u305c\u3072\u305c\u3072\u6d3b\u7528\u3057\u3066\u3044\u304d\u305f\u3044\u3067\u3059\u306d\uff01<\/p>\n<p>\u305d\u308c\u3067\u306f\u307e\u305f\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u308f\u3002web\u30c7\u30b6\u30a4\u30ca\u30fc\u306e\u6c60\u7530\u3067\u3059\u3002 \u5f0a\u793e\u3067\u306f\u30aa\u30ea\u30b8\u30ca\u30eb\u30ec\u30fc\u30d9\u30eb\u300cpeakvox\u300d\u306b\u3066facebook\u3092\u904b\u7528\u3057\u3066\u3044\u308b\u306e\u3067\u3059\u304c\u3001 \u7a81\u7136facebook\u306e\u66f4\u65b0\u60c5\u5831\u304c\u53d6\u5f97\u3067\u304d\u306a\u304f\u306a\u308a\u3001\u3059\u3053\u3057\u30cf\u30de\u3063\u3066\u3057\u307e\u3063\u305f\u306e\u3067\u5171\u6709\u3055\u305b\u3066\u9802 [&hellip;]<\/p>\n","protected":false},"author":12,"featured_media":402,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[8],"tags":[34,39,40],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.otwo.jp\/blog\/wp-json\/wp\/v2\/posts\/1494"}],"collection":[{"href":"https:\/\/www.otwo.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.otwo.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.otwo.jp\/blog\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/www.otwo.jp\/blog\/wp-json\/wp\/v2\/comments?post=1494"}],"version-history":[{"count":25,"href":"https:\/\/www.otwo.jp\/blog\/wp-json\/wp\/v2\/posts\/1494\/revisions"}],"predecessor-version":[{"id":2692,"href":"https:\/\/www.otwo.jp\/blog\/wp-json\/wp\/v2\/posts\/1494\/revisions\/2692"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.otwo.jp\/blog\/wp-json\/wp\/v2\/media\/402"}],"wp:attachment":[{"href":"https:\/\/www.otwo.jp\/blog\/wp-json\/wp\/v2\/media?parent=1494"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.otwo.jp\/blog\/wp-json\/wp\/v2\/categories?post=1494"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.otwo.jp\/blog\/wp-json\/wp\/v2\/tags?post=1494"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}