|  | 
	                
  
    | 
	 
        ช่วยหน่อยครับ เกี่ยวกับ graph facebook comment phpดึงค่ามาใช้ ขอความรู้หน่อยครับ     |  
    |  |  
 
	
		|  |  |  |  |  
		|  |  | 
          
            | Code (PHP) 
 <?php 
	
	$url = "https://graph.facebook.com/comments/?ids=http://www.test99.com";
	$ch = curl_init($url);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
	$output = curl_exec($ch);
	curl_close($ch); 
	echo $output;
	?>
 OUTPUT
 
  
 Code
 
 {"http:\/\/www.test99.com":{"comments":{"data":[{"id":"10150485071729917_10153113717054917","from":{"id":"100003633069357","name":"\u0e09\u0e31\u0e15\u0e23 \u0e27\u0e07\u0e28\u0e4c\u0e1b\u0e23\u0e35\u0e0a\u0e32\u0e01\u0e34\u0e08\u0e23\u0e38\u0e48\u0e07"},"message":"asdsad","can_remove":false,"created_time":"2015-02-12T10:23:26+0000","like_count":0,"user_likes":false}],"paging":{"cursors":{"after":"MQ==","before":"MQ=="}}}}
 
 ควรทำยังไงถึง จะเลือก id หรือ เลือก object ต่างๆ ได้อะครับ
 ขอความรู้จากผู้รู้หน่อยครับ
 
 
 
 Tag : PHP
 
 
 |  
            |  |  
            | 
              
                |  |  |  |  
                |  | 
                    
                      | Date :
                          2015-02-12 17:37:48 | By :
                          baseron01 | View :
                          1091 | Reply :
                          2 |  |  |  
                |  |  |  |  |  
            |  |  
		            |  |  
		|  |  |  |  |  
  
    | 
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ลองแบบนี้ดูครับต้องกำหนดให้เป็นข้อมูลแบบ json ก่อนครับง่ายดี 
 Code (PHP)
 
 $data = file_get_contents("https://graph.facebook.com/comments/?ids=http://www.test99.com");
$data = json_decode($data, true);
$comments = $data['http://www.test99.com']['comments']['data'];
echo "<pre>"; print_r($comments); echo "</pre>";
 ค่าที่อ่านได้
 
 
 {
   "http://www.test99.com": {
      "comments": {
         "data": [
            {
               "id": "10150485071729917_10153113717054917",
               "from": {
                  "id": "100003633069357",
                  "name": "\u0e09\u0e31\u0e15\u0e23 \u0e27\u0e07\u0e28\u0e4c\u0e1b\u0e23\u0e35\u0e0a\u0e32\u0e01\u0e34\u0e08\u0e23\u0e38\u0e48\u0e07"
               },
               "message": "asdsad",
               "can_remove": false,
               "created_time": "2015-02-12T10:23:26+0000",
               "like_count": 0,
               "user_likes": false
            }
         ],
         "paging": {
            "cursors": {
               "after": "MQ==",
               "before": "MQ=="
            }
         }
      }
   }
}
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2015-02-12 17:58:49 | By :
                            somparn |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ขอบคุณครับ 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2015-02-13 15:04:28 | By :
                            baseron01 |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  |  |