実行結果' ; // エラー判定 if( !$obj || !isset($obj->data) ) { $html .= '

データを取得できませんでした…。設定を再確認して下さい。

' ; } else { // コメントを解析 foreach( $obj->data as $item ) { // 各データの整理 $id = $item->id ; // コメントID $text = $item->text ; // コメント本文 $created_time = $item->created_time ; // 投稿日時 $from_id = $item->from->id ; // ユーザーID $from_username = $item->from->username ; // ユーザー名 $from_profile_picture = ( isset( $item->from->profile_picture ) ) ? $item->from->profile_picture : '' ; // アイコン画像 $from_full_name = ( isset( $item->from->full_name ) ) ? $item->from->full_name : '' ; // フルネーム // 日付の整形 $date = date( 'Y/m/d H:i' , $created_time ) ; // ブラウザに出力 $html .= '
' ; $html .= '
ユーザーID
' ; $html .= '
' . $from_id . '
' ; $html .= '
ユーザー名
' ; $html .= '
' . $from_username . '
' ; // フルネーム if( $from_full_name ) { $html .= '
フルネーム
' ; $html .= '
' . $from_full_name . '
' ; } // アイコン画像 if( $from_profile_picture ) { $html .= '
アイコン画像
' ; $html .= '
' ; } $html .= '
コメント
' ; $html .= '
' . $text . '
' ; $html .= '
投稿日時
' ; $html .= '
' . $date . '
' ; $html .= '
コメントID
' ; $html .= '
' . $id . '
' ; $html .= '
' ; } } // 取得したデータ $html .= '

取得したデータ

' ; $html .= '

下記のデータを取得できました。

' ; $html .= '

JSON

' ; $html .= '

' ; $html .= '

レスポンスヘッダー

' ; $html .= '

' ; // アプリケーション連携の解除 $html .= '

アプリケーション連携の解除

' ; $html .= '

このアプリケーションとの連携は、下記設定ページで解除することができます。

' ; $html .= '

https://instagram.com/accounts/manage_access/

' ; ?> Instagramでコメントを取得するサンプルデモ

配布元: Syncer