i have wordpress blog. need index how many times each page shared , sort posts number of shares.
i made small script makes requests each page in blog,
while ($posts->have_posts()) { $posts->the_post(); $obj_fb = json_decode(file_get_contents('http://graph.facebook.com/?id=' . get_permalink())); $likes_fb = $obj_fb->shares; update_post_meta($post->id, 'meta_fb_likes', $likes_fb, false); } notice not use access tokens.
the script works number of pages, 50 or 100, when process large amount of pages, 300 or so, takes minute , returns execution error 403 graph api.
please advice i'm doing wrong.
you not using access tokens, , problem. must use access token call now. use app access token, that´s easiest 1 , don´t need authorize that.
how access tokens explained in docs:
- https://developers.facebook.com/docs/facebook-login/access-tokens
- http://www.devils-heaven.com/facebook-access-tokens/
edit: oh, see still work you, problem api rate limit. well, thing can avoid less calls. there no specific limit, in general "600 calls in 600 seconds" rule find in many threads.
Comments
Post a Comment