Fql Adresi :
https://graph.facebook.com/fql?q=select+post_fbid%2C+username%2C+post_fbid%2C+fromid%2C+text%2C+time+from+comment+where+object_id+in+%28select+comments_fbid+from+link_stat+where+url+%3D%27
{
"error": {
"message": "(#601) Parser error: unexpected ''' at position 138.",
"type": "OAuthException",
"code": 601
}
}
Yorumkaydet.php
require('config.php');
header('Content-type: text/html; charset=utf-8');
$otelid = mysql_real_escape_string($_GET['save']);
date_default_timezone_set('Europe/Istanbul');
$tarih = date('Y-m-d H:i:s');
$ip = getenv("REMOTE_ADDR");
$q = "SELECT seo_title FROM words WHERE word_id = '$otelid'";
$row = mysql_fetch_assoc(mysql_query($q));
$url = 'http://www.trtatil.com/' . str_replace(" ","-",$row['seo_title']) . '.html';
$urlencode = urlencode($url);
$fql = 'https://graph.facebook.com/fql?q=select+post_fbid%2C+username%2C+post_fbid%2C+fromid%2C+text%2C+time+from+comment+where+object_id+in+%28select+comments_fbid+from+link_stat+where+url+%3D%27' . $urlencode . '%27%29+order+by+time+DESC+limit+0,1+&pretty=1';
$fbdata = json_decode(file_get_contents($fql));
$fbid = $fbdata->data[0]->fromid;
$commentid = $fbdata->data[0]->post_fbid;
$message = $fbdata->data[0]->text;
$message = str_replace(
array("\xe2\x80\x98", "\xe2\x80\x99", "\xe2\x80\x9c", "\xe2\x80\x9d"),
array("'", "'", '"', '"'),
$message);
$message = addslashes(iconv("UTF-8","ISO-8859-9",$message));
$profileurl = 'https://graph.facebook.com/' . $fbid . '';
$profiledata = json_decode(file_get_contents($profileurl));
$name = $profiledata->name;
$name = addslashes(iconv("UTF-8","ISO-8859-9",$name));
if (!empty($name) AND !empty($commentid) AND (strlen($message)>0)) {
// Yorum Kaydet
mysql_query("INSERT IGNORE INTO comments SET otelid='$otelid', yorumcu='$name', yorum='$message', tarih='$tarih', commentid='$commentid', fbid='$fbid', ip='$ip', status='0';");
}
?>