Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function GetCH($url){
- $ch=null;
- if(!$ch){
- $ch = curl_init();
- }
- curl_setopt($ch, CURLOPT_URL, "".$url."");
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_FORBID_REUSE, true);
- curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
- curl_setopt($ch, CURLOPT_TIMEOUT, 20);
- curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
- curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- $return=curl_exec($ch);
- if(!curl_errno($ch)){
- return $return;
- }else{
- $fb_fail=curl_error($ch);
- return $fb_fail;
- }
- curl_close($ch);
- unset($ch);
- }; //json_decode()
- $query = '{"feed":"SELECT post_id, message,description, actor_id, type,created_time, updated_time,attachment, like_info, comment_info FROM stream WHERE filter_key IN(SELECT filter_key FROM stream_filter WHERE uid = me() AND name in (\'Photos\')) limit 5 offset 0"}';
- $build = 'https://graph.facebook.com/fql?q='.urlencode($query).'&access_token=USER_TOKEN';
- $returned=GetCH($build);
- $locs=json_decode($returned, true);
- echo '<pre>';
- print_r($locs);
- echo '</pre>';
- $commentquery = '{';
- foreach($locs[data][0][fql_result_set] as $key => $value){
- $commentquery .= '"'.$value[post_id].'_comments":"select post_id, fromid,text from comment where post_id = \''.$value[post_id].'\' limit 10", ';
- }
- $commentquery .= '}';
- $commentbuild = 'https://graph.facebook.com/fql?q='.urlencode($commentquery).'&access_token=USER_TOKEN';
- $returned=GetCH($commentbuild);
- $locsc=json_decode($returned, true);
- echo '<pre>';
- print_r($locsc);
- echo '</pre>';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement