Ben json biçimi ile bir url veri getirmek için bu php kodu yazdım ve o amele gibi görünüyordu ama ben açtığımda uygun access_token ile $ url koymakFacebook'dan JSON formatı nasıl ayrıştırılır?
<?php
session_start();
$con= mysqli_connect("localhost","root","") or die ("could not connect to mysql");
mysqli_select_db($con,"facebook_data") or die ("no database");
$url = "https://graph.facebook.com/209024949216061/feed?fields=created_time,from,type,message&access_token=XXXXXXXX";
$ch = curl_init($url);
curl_setopt($ch,CURLOPT_HEADER, false);
$curlResponse = curl_exec($ch);
$data = json_decode($curlResponse,TRUE);
if (is_array($data) || is_object($data)) {
foreach($data as $row){
$id=$row["id"];
$created_time=$row["created_time"];
$type=$row["type"];
$message=$row["message"];
$user_id=$row["from"]["id"];
$username=$row["from"]["name"];
$sql="INSERT INTO group_feed(id, username, created_time, user_id, type, message) VALUES('$id','$username','$created_time','$user_id', '$type', '$message')";
if(!mysql_query($sql,$con))
{
die('Error : ');
}
}
}
?>
veritabanında şey alamadım tarayıcımdaki bağlantı bana sorunun nerede olabileceğini JSON formatı DATA gösteriyor? curl()
ilgili daha fazla bilgi için