如何将其放在代码https://graph.facebook.com/ql?q=http://google.com上

时间:2017-10-22 18:49:53

标签: javascript php arrays facebook facebook-graph-api

(请不要点击负面/下降率。我需要回答这个问题。谢谢你)

我非常擅长编码+学习我想编辑我的网站中的代码,这段代码/链接https://graph.facebook.com/?id=http://google.com已被弃用。但是,我发现了新的更新代码/链接 $curl_response = $this->curl->get($callback_url . http_build_query($data, '', '&')); if ($curl_response->headers['Status-Code'] == "200") { $parse_response = json_decode($curl_response, true); $fb_share_count = $parse_response['data'][0]['share_count']; $fb_like_count = $parse_response['data'][0]['like_count']; $fb_comment_count = $parse_response['data'][0]['comment_count']; } else { $fb_share_count = 0; $fb_like_count = 0; $fb_comment_count = 0; } $response = array( 'status' => 'success', 'data' => array( 'fb_share_count' => filter_var($fb_share_count, FILTER_SANITIZE_NUMBER_INT), 'fb_like_count' => filter_var($fb_like_count, FILTER_SANITIZE_NUMBER_INT), 'fb_comment_count' => filter_var($fb_comment_count, FILTER_SANITIZE_NUMBER_INT) ) ); } catch (Exception $e) { $response = array( 'status' => 'error', 'msg' => $e->getMessage() ); } return $response; }

现在这里是需要编辑的代码:


public function getFacebookData($domain) { try { $callback_url = "https://graph.facebook.com/fql?"; $data = array( 'q' => "SELECT comment_count, like_count, share_count FROM link_stat WHERE url='$domain'" );

public boolean isPrime(int number) { if(number < 2) return false; for(int i = 2; i <= Math.sqrt(number); i++) { if(n % i == 0) { return false; } } return true; }

1 个答案:

答案 0 :(得分:0)

将代码中的callback_url更改为

$ callback_url =&#34; https://graph.facebook.com/v2.2/?&#34;