Efficiently Follow Pinterest Users through follow API, within given time period in PHP Codeigniter -


pinterest api follow: limit 1000 hits per hour per user access token https://api.pinterest.com/v1/me/following/users/?access_token=xxxxxxxx&user=xxxxxxx

+-------------+---------------------+------------------+ |   userid    | usertofollowperhour | maxuseravailable | +-------------+---------------------+------------------+ | 1           |                 100 |              1000| | 2           |                 200 |              9000| | 3           |                 210 |               100| | 4           |                 300 |              1100| | 5           |                 300 |               900| | .           |                     |                  | | .           |                     |                  | | .           |                     |                  | | n           |                    n|                 n| +-------------+---------------------+------------------+ 

now have follow users particular userid that: can follow users within limit , pinterest not block profile

currently, doing by: cron hit url of following function after every 3 hours function is:

  1. calculating user follow in 1 loop eg:

        1. let currenttime = 1:00         , endtime = 2:00         user follow = 300         timeremaining = currenttime-endtime => 60 minutes         300/60 = 5 => ceil(5)=5     2. fetch 5 user in 1 iteration pinterest     3. follow them 1 one in secont loop      4. after again calculate until usertofllow become 0         300-5=295 =>  ceil(295/timeremaining(let 59)) = 5     5. again 1 next user 

    output

by above logic of our users got banned/blocked may due pinterest reason

please suggest me answer solution if possible, whether should use multi thread or more functions async. happy if can accomplished codeigniter only


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -