php - Facebook Graph reply to Search Result -
in twitter search api can use unique id every search result has reply post.
eg (php):
$twitter_json = file_get_contents("http://search.twitter.com/search.json?q=".$query."&lang=en", true); $twitter_search_res = json_decode($twitter_json, true); $id = $twitter_search_res['results'][0]['id']; echo "<a href = 'https://twitter.com/intent/tweet?in_reply_to={$id}'>"; how can reply post facebook graph search returns?
$fb_json = file_get_contents("http://graph.facebook.com/search?q=".$query."", true); $fb_search_res = json_decode($fb_json, true); with 1 of results being:
array(7) { ["id"]=> string(31) "100000101152749_627923180554381" ["from"]=> array(2) { ["name"]=> string(19) "jellie artus judith" ["id"]=> string(15) "100000101152749" } ["message"]=> string(101) "here comes awaited event of our lives. hahaha graduation of wave95 (expedia) :) pakal time.." ["privacy"]=> array(1) { ["value"]=> string(0) "" } ["type"]=> string(6) "status" ["created_time"]=> string(24) "2013-04-18t19:18:23+0000" ["updated_time"]=> string(24) "2013-04-18t19:18:23+0000" } i tired using https://graph.facebook.com/{$fb_result_id}/comments id returned graph search doesn't seem correct one. split id @ '_' , neither of worked.
as indicated on https://developers.facebook.com/docs/reference/api/search/, http://graph.facebook.com/search?q=your_query search public posts, kind of posts not post friends, doesn't have permissions comments.
if want search post news feed, can
https://graph.facebook.com/me/home?q=a&access_token=user_access_token
example comment post_id using curl:
<?php //extract data post extract($_post); //set post variables $url = 'https://graph.facebook.com/150552388343703_483757795023159/comments?access_token=user_access_token'; $msg = 'hello world testing'; $fields = array( 'message' => urlencode($msg), ); //url-ify data post foreach($fields $key=>$value) { $fields_string .= $key.'='.$value.'&'; } rtrim($fields_string, '&'); //open connection $ch = curl_init(); //set url, number of post vars, post data curl_setopt($ch,curlopt_url, $url); curl_setopt($ch,curlopt_post, count($fields)); curl_setopt($ch,curlopt_postfields, $fields_string); //execute post $result = curl_exec($ch); //close connection curl_close($ch); ?>
Comments
Post a Comment