본문 바로가기
  • 행복하게 오래오래 개발자로 살아가기
Old/PHP

facebook comment plugin json parsing

by yundev 2013. 7. 12.
반응형
$data=file_get_contents(https://graph.facebook.com/comments/?ids='comment plugin 코드가 있는 위치');
$dataDecode=json_decode($data);

$test=$dataDecode->{'comment_write.php'}->{'comments'}->{'data'};

foreach($test as $key)
{
	$id=$key->{'from'}->{'id'};
	echo "";
	$name=$key->{'from'}->{'name'};
	echo $name;
	$message=$key->{'message'};
	echo $message;
	$created_time=substr($key->{'created_time'},0,10);
	echo $created_time."
"; }

객체에 접근할 때는 ->

참고 하면 좋은 사이트 https://developers.facebook.com/docs/reference/plugins/comments/ http://php.net/manual/en/function.json-decode.php

반응형

'Old > PHP' 카테고리의 다른 글

php 익스플로어 버젼 체크  (0) 2013.08.01
글자수 줄이기 mb_strimwidth  (0) 2013.07.17
isset  (0) 2013.07.11
12시간 단위의 시간값 가져오기  (0) 2013.07.11
하루전, 하루후 등 게시물 검색하기  (0) 2013.07.05