0

페이스 북 php sdk를 사용하여 다른 사람이 사용자의 벽에 작성한 모든 게시물에 대한 주석 목록을 얻으려고합니다. 다음과 같이 나는 배치 API 요청에 FQL을 사용하고 있습니다 : 종속 fql 쿼리의 in 절에 대한 jsonpath 요소를 인용/이스케이프 처리합니다.

$getStream = urlencode("method/fql.query?query=SELECT post_id, actor_id, target_id, source_id,viewer_id, message FROM stream WHERE app_id= '' and message != '' and source_id=$fbprofileId and target_id=$fbprofileId and is_hidden=0 limit 100"); 
$getComments = urlencode("method/fql.query?query=select object_id, post_id, fromid, time, text, id, likes, comments, user_likes, is_private from comment where post_id in({result=get-stream:$.*.post_id})"); 
$queries = array(
        array('method'     => 'POST', 
          'omit_response_on_success' => false, 
          'name'      => 'get-stream', 
          'relative_url'    => $getStream), 
        array('method'     => 'POST', 
          'omit_response_on_success' => false, 
          'name'      => 'get-comments', 
          'relative_url'    => $getComments) 
       ); 
return $this->fbApi->api('?batch='.json_encode($queries), 'POST'); 

I FB에서 다음과 같은 응답을 얻을 :

{"error_code":601,"error_msg":"Parser error: unexpected '_1831955838114' at position 63.","request_args":[{"key":"method","value":"fql_query"},{"key":"format","value":"json"},{"key":"_fb_batch_child_request","value":"1"},{"key":"query","value":"select user_id, object_id from like where post_id in(1216940586_1831955838114,1216940586_1831891396503,1216940586_1831423824814,1216940586_1828915522108,1216940586_1822006149378,1216940586_1820687356409,1216940586_1813971228510,1216940586_1809392594047,1216940586_1795412004541,1216940586_1795177518679)"},{"key":"_fb_url","value":"method\/fql.query"},{"key":"access_token","value":"AAAC02IZB..."}]} 

post_ids 인용 사실, 사용할 필요가 분명히 보인다 동일한 쿼리 fb 그래프 api explorer with IN 절에서 인용 된 post_ids를 사용하면 결과가 잘됩니다.

** post_ids는 문자열 (int가 아님)이므로 관련 배치 API FQL 쿼리의 컨텍스트에서 FQL IN 절에 적절한 인수를 지정하려면 어떻게해야합니까? **

그것은 조금 늦게, 가장 가능성이 있지만,이 대안으로 FQL API를 올바르게 유형을 처리 일괄 쿼리를 지원하는 것

답변

0

:

http://developers.facebook.com/docs/reference/fql/ 당신은 쿼리의 JSON지도를 만들고, 함께 그들을 보내

https://graph.facebook.com/fql?q={ 
    "friends":"SELECT uid2 FROM friend WHERE uid1=me()", 
    "with_birthdays":"SELECT uid, name FROM user WHERE uid IN (select uid2 from #friends) and birthday_date" 
}&access_token=yourToken29873 

분명히 이러한 쿼리를 인코딩합니다 (읽기 쉽도록 인코딩되지 않은 채로 남음). 나는 일괄 API 내에서 이것에 대한 해결책을 찾을 수 있는지 알아보고, 내가 찾으면 편집 할 것이다.

(편집 : 여기 운, 미안 꽤했지만, 내가 하나가 오류없이 결과 또는 파서 오류를 얻을 수 없다.)

+0

감사해야한다 -이 FQL 기능을 인식하지 않았다 - 내가해볼 께! –

-1

이 해결책이 될 것으로 보인다는 '{결과 = GET- .. 스트림 : $ * post_id를} 그래서

$getComments = urlencode("method/fql.query?query=select object_id, post_id, fromid, time, text, id, likes, comments, user_likes, is_private from comment where post_id in('{result=get-stream:$.*.post_id}')");