如何使用fb app减慢发布速度?

时间:2012-04-03 20:29:23

标签: facebook facebook-graph-api cron facebook-php-sdk crontab

下面是我的应用程序的代码

        $response1 = $facebook->api('/294120253958442' . '/feed','POST',$WallPost); sleep(5);
        $response2 = $facebook->api('/134804409926272' . '/feed','POST',$WallPost); sleep(15);
        $response3 = $facebook->api('/202619002037' . '/feed','POST',$WallPost); sleep(8);
        $response4 = $facebook->api('/30410040944' . '/feed','POST',$WallPost); sleep(6);
        $response5 = $facebook->api('/103561223082520' . '/feed','POST',$WallPost); sleep(12);

我使用这个文本与睡眠计时器,但问题是,一些帖子发布正确,但一些立即发布是有任何完美的解决方案,我必须做出近123 api请求,人们会喜欢和评论

所以问题是,有没有办法让fb认为这是正常的请求,比如我使用sleep()但它无法正常工作?

注意:我在我所选择的群组中发帖,我必须授权发布,我只是分享我要分享的消息,而不是垃圾邮件以获取更多信息,请在投票前讨论,谢谢

更新

下面是我的朋友zerkms要求的完整文件代码:)     

        //making fb instance so that we can make api calls 
        require_once 'library/facebook.php';


            // Create our Application instance.
            $facebook = new Facebook(array(
              'appId' => '1498*53*179__47',
              'secret' => 'Shhh... Its Seceret ;)',
              'cookie' => true,
            )); 


        //Prepare Wall post

            //connecting to mysql server and database than get the data 
                $con1 = mysql_connect("localhost","user","pass;)");
                    if (!$con1)
                      {
                          die('Could not connect: ' . mysql_error());
                          }


                mysql_select_db('db:P');

                //get last post info
                $query = mysql_query("SELECT * FROM info:) LIMIT 1");
                $row = mysql_fetch_array($query);
                $last_post = $row["last_post"];


                //get current post data 
                $query1 = mysql_query("SELECT * FROM post_data;) WHERE ID=$last_post  LIMIT 1");
                $row1 = mysql_fetch_array($query1);


            //store table data in variable 
                $pmessage = $row1["message"];
                $plink = $row1["link"];
                $pname = $row1["name"];
                $pcaption = $row1["caption"];
                $pdescription = $row1["description"];
                $ppicture = $row1["picture"];
                $psource = $row1["source"];



            //long life access_token

                $long_life_token = "AAACITTZBnadsBAEKaetzal7w*pk0yBgeaRMZAit8iZAbhqyXVX*3IYCZB_changed_CtS3CrqBmLa9rPueABbZAmZClX1bwZDZD";

        //'picture' => $ppicture, 'source' => $psource include this latter

                    // compile the post for for user
                        $WallPost = array(
                            'access_token' => $long_life_token,
                            'message' => $pmessage,
                            'link' => $plink,
                            'name' => $pname,
                            'caption' => $pcaption,
                            'description' => $pdescription);  


        //making api call so that it can post on target wall
        $response = $facebook->api('/me' . '/feed','POST',$WallPost);

            $last_post_update = $last_post + 1;


    //update info table that post posted and next time we use next post for posting

        mysql_query("UPDATE info SET last_post=$last_post_update WHERE id='1'");

    //posting to groups wall with sleeping time support poster.xls
            $response1 = $facebook->api('/*941*0*395844*' . '/feed','POST',$WallPost); sleep(5);
            $response* = $facebook->api('/1348044099***7*' . '/feed','POST',$WallPost); sleep(15);
            $response3 = $facebook->api('/*0**1900*037' . '/feed','POST',$WallPost); sleep(8);
            $response4 = $facebook->api('/30410040944' . '/feed','POST',$WallPost); sleep(*);
            $response5 = $facebook->api('/1035*1**308*5*0' . '/feed','POST',$WallPost); sleep(1*);
            $response* = $facebook->api('/10*477739430335' . '/feed','POST',$WallPost); sleep(1*);
            $response7 = $facebook->api('/84**05480*' . '/feed','POST',$WallPost); sleep(1*);
            $response8 = $facebook->api('/187350*04**08**' . '/feed','POST',$WallPost); sleep(11);
            $response9 = $facebook->api('/4*39***49744' . '/feed','POST',$WallPost); sleep(10);
            $response10 = $facebook->api('/171***10**51' . '/feed','POST',$WallPost); sleep(13);
            $response11 = $facebook->api('/1*9197031*7*' . '/feed','POST',$WallPost); sleep(14);
            $response1* = $facebook->api('/10054*45**870*5' . '/feed','POST',$WallPost); sleep(*);
            $response13 = $facebook->api('/*45144714*93' . '/feed','POST',$WallPost); sleep(9);
            $response14 = $facebook->api('/17343**7*717815' . '/feed','POST',$WallPost); sleep(*);
            $response15 = $facebook->api('/111915**5557801' . '/feed','POST',$WallPost); sleep(9);
            $response1* = $facebook->api('/133*0138**55770' . '/feed','POST',$WallPost); sleep(7);
            $response17 = $facebook->api('/158797974189338' . '/feed','POST',$WallPost); sleep(10);
            $response18 = $facebook->api('/*33*3078**94*08' . '/feed','POST',$WallPost); sleep(1*);
            $response19 = $facebook->api('/17410*979300***' . '/feed','POST',$WallPost); sleep(1*);
            $response*0 = $facebook->api('/157*481*430*458' . '/feed','POST',$WallPost); sleep(9);
            $response*1 = $facebook->api('/1*3941*97*85181' . '/feed','POST',$WallPost); sleep(11);
            $response** = $facebook->api('/1**089951*37501' . '/feed','POST',$WallPost); sleep(14);
            $response*3 = $facebook->api('/315**3*451*59*4' . '/feed','POST',$WallPost); sleep(10);
            $response*4 = $facebook->api('/***37895044*1*3' . '/feed','POST',$WallPost); sleep(7);
            $response*5 = $facebook->api('/*3*054393471390' . '/feed','POST',$WallPost); sleep(*);
            $response** = $facebook->api('/*440*1515*14491' . '/feed','POST',$WallPost); sleep(1*);
            $response*7 = $facebook->api('/184*7409490*430' . '/feed','POST',$WallPost); sleep(9);
            $response*8 = $facebook->api('/1*8978959817*19' . '/feed','POST',$WallPost); sleep(7);
            $response*9 = $facebook->api('/154*101413***7*' . '/feed','POST',$WallPost); sleep(7);
            $response30 = $facebook->api('/191***8809093*1' . '/feed','POST',$WallPost); sleep(*);
            $response31 = $facebook->api('/137*33949*59387' . '/feed','POST',$WallPost); sleep(7);
            $response3* = $facebook->api('/114474*38**4551' . '/feed','POST',$WallPost); sleep(10);
            $response33 = $facebook->api('/133*715934049*1' . '/feed','POST',$WallPost); sleep(9);
            $response34 = $facebook->api('/18**559*5137*33' . '/feed','POST',$WallPost); sleep(9);
            $response35 = $facebook->api('/1879447979*4870' . '/feed','POST',$WallPost); sleep(7);
            $response3* = $facebook->api('/1*1**94*7*37*85' . '/feed','POST',$WallPost); sleep(9);
            $response37 = $facebook->api('/175**51*91144**' . '/feed','POST',$WallPost); sleep(11);
            $response38 = $facebook->api('/15900418749*799' . '/feed','POST',$WallPost); sleep(11);
            $response39 = $facebook->api('/14487*885*10753' . '/feed','POST',$WallPost); sleep(*);
            $response40 = $facebook->api('/***9**507048858' . '/feed','POST',$WallPost); sleep(11);
            $response41 = $facebook->api('/*3*15140013*073' . '/feed','POST',$WallPost); sleep(9);
            $response4* = $facebook->api('/*07474*4***9741' . '/feed','POST',$WallPost); sleep(13);
            $response43 = $facebook->api('/151079718*78488' . '/feed','POST',$WallPost); sleep(7);
            $response44 = $facebook->api('/117*81001*43907' . '/feed','POST',$WallPost); sleep(8);
            $response45 = $facebook->api('/13*50*91*8*7594' . '/feed','POST',$WallPost); sleep(7);
            $response4* = $facebook->api('/1781*9*7**3*845' . '/feed','POST',$WallPost); sleep(1*);
            $response47 = $facebook->api('/3*9089400705' . '/feed','POST',$WallPost); sleep(9);
            $response48 = $facebook->api('/183898734978809' . '/feed','POST',$WallPost); sleep(8);
            $response49 = $facebook->api('/133453830051738' . '/feed','POST',$WallPost); sleep(10);
            $response50 = $facebook->api('/19*5151003*9374' . '/feed','POST',$WallPost); sleep(*);
            $response51 = $facebook->api('/1750793**574*93' . '/feed','POST',$WallPost); sleep(7);
            $response5* = $facebook->api('/*57554**4*7*93*' . '/feed','POST',$WallPost); sleep(13);
            $response53 = $facebook->api('/***3458071*0538' . '/feed','POST',$WallPost); sleep(9);
            $response54 = $facebook->api('/13430*43000*404' . '/feed','POST',$WallPost); sleep(11);
            $response55 = $facebook->api('/*77199875*3*5**' . '/feed','POST',$WallPost); sleep(10);
            $response5* = $facebook->api('/*54157594*37337' . '/feed','POST',$WallPost); sleep(13);
            $response57 = $facebook->api('/*8449745159*533' . '/feed','POST',$WallPost); sleep(*);
            $response58 = $facebook->api('/31487*4*1878045' . '/feed','POST',$WallPost); sleep(13);
            $response59 = $facebook->api('/*4943*4117707*1' . '/feed','POST',$WallPost); sleep(11);
            $response*0 = $facebook->api('/**7*8*5799989*5' . '/feed','POST',$WallPost); sleep(9);
            $response*1 = $facebook->api('/18*530908489557' . '/feed','POST',$WallPost); sleep(10);
            $response** = $facebook->api('/*877553*458415*' . '/feed','POST',$WallPost); sleep(10);
            $response*3 = $facebook->api('/*4844*48185*9*4' . '/feed','POST',$WallPost); sleep(*);
            $response*4 = $facebook->api('/1*5504393489378' . '/feed','POST',$WallPost); sleep(1*);
            $response*5 = $facebook->api('/1*4**58035**757' . '/feed','POST',$WallPost); sleep(9);
            $response** = $facebook->api('/*5403158795****' . '/feed','POST',$WallPost); sleep(9);
            $response*7 = $facebook->api('/179015*454*7358' . '/feed','POST',$WallPost); sleep(1*);
            $response*8 = $facebook->api('/*4407333937' . '/feed','POST',$WallPost); sleep(11);
            $response*9 = $facebook->api('/*14810578534008' . '/feed','POST',$WallPost); sleep(*);
            $response70 = $facebook->api('/*3*148493075*99' . '/feed','POST',$WallPost); sleep(8);
            $response71 = $facebook->api('/11193144**4495*' . '/feed','POST',$WallPost); sleep(7);
            $response7* = $facebook->api('/*375**97*9*3871' . '/feed','POST',$WallPost); sleep(13);
            $response73 = $facebook->api('/185**997144*979' . '/feed','POST',$WallPost); sleep(*);
            $response74 = $facebook->api('/1009957133*09**' . '/feed','POST',$WallPost); sleep(9);
            $response75 = $facebook->api('/15*71780480*458' . '/feed','POST',$WallPost); sleep(15);
            $response7* = $facebook->api('/19*783437031189' . '/feed','POST',$WallPost); sleep(1*);
            $response77 = $facebook->api('/1**0985*0795384' . '/feed','POST',$WallPost); sleep(9);
            $response78 = $facebook->api('/17173853951707*' . '/feed','POST',$WallPost); sleep(5);
            $response79 = $facebook->api('/1*1300933893455' . '/feed','POST',$WallPost); sleep(8);
            $response80 = $facebook->api('/1110945*899***1' . '/feed','POST',$WallPost); sleep(5);
            $response81 = $facebook->api('/18019587*0*1**4' . '/feed','POST',$WallPost); sleep(10);
            $response8* = $facebook->api('/15*805038117037' . '/feed','POST',$WallPost); sleep(14);
            $response83 = $facebook->api('/1300774704*5043' . '/feed','POST',$WallPost); sleep(10);
            $response84 = $facebook->api('/1*753918398*981' . '/feed','POST',$WallPost); sleep(13);
            $response85 = $facebook->api('/114514**1938101' . '/feed','POST',$WallPost); sleep(14);
            $response8* = $facebook->api('/1*3744*9038*735' . '/feed','POST',$WallPost); sleep(14);
            $response87 = $facebook->api('/10*10*97*150035' . '/feed','POST',$WallPost); sleep(*);
            $response88 = $facebook->api('/190**98943**081' . '/feed','POST',$WallPost); sleep(14);
            $response89 = $facebook->api('/17*47151*7***44' . '/feed','POST',$WallPost); sleep(9);
            $response90 = $facebook->api('/***8744437*8715' . '/feed','POST',$WallPost); sleep(*);
            $response91 = $facebook->api('/*****74477455*3' . '/feed','POST',$WallPost); sleep(13);
            $response9* = $facebook->api('/194974453897*45' . '/feed','POST',$WallPost); sleep(1*);
            $response93 = $facebook->api('/1873*78579**744' . '/feed','POST',$WallPost); sleep(1*);
            $response94 = $facebook->api('/*7**3183*1*351*' . '/feed','POST',$WallPost); sleep(8);
            $response95 = $facebook->api('/**0808*579778*3' . '/feed','POST',$WallPost); sleep(10);
            $response9* = $facebook->api('/*093457*5759184' . '/feed','POST',$WallPost); sleep(5);
            $response97 = $facebook->api('/*49****71754051' . '/feed','POST',$WallPost); sleep(9);
            $response98 = $facebook->api('/190487**0971307' . '/feed','POST',$WallPost); sleep(11);
            $response99 = $facebook->api('/1445955*8938380' . '/feed','POST',$WallPost); sleep(8);
            $response100 = $facebook->api('/*03438579**9*81' . '/feed','POST',$WallPost); sleep(7);
            $response101 = $facebook->api('/1147779*8*091**' . '/feed','POST',$WallPost); sleep(*);
            $response10* = $facebook->api('/1*8*89**7*40*08' . '/feed','POST',$WallPost); sleep(10);
            $response103 = $facebook->api('/*9*88*835781' . '/feed','POST',$WallPost); sleep(7);
            $response104 = $facebook->api('/1870*49980*47**' . '/feed','POST',$WallPost); sleep(7);
            $response105 = $facebook->api('/*358741898*8*48' . '/feed','POST',$WallPost); sleep(1*);
            $response10* = $facebook->api('/10***9409443*31' . '/feed','POST',$WallPost); sleep(*);
            $response107 = $facebook->api('/34*5*104*03*917' . '/feed','POST',$WallPost); sleep(10);
            $response108 = $facebook->api('/*45847838808173' . '/feed','POST',$WallPost); sleep(7);
            $response109 = $facebook->api('/184*7780157*777' . '/feed','POST',$WallPost); sleep(8);
            $response110 = $facebook->api('/1*83030*3*17*53' . '/feed','POST',$WallPost); sleep(9);
            $response111 = $facebook->api('/*58**851758958*' . '/feed','POST',$WallPost); sleep(8);
            $response11* = $facebook->api('/3197*341805**18' . '/feed','POST',$WallPost); sleep(10);
            $response113 = $facebook->api('/384*10481*0789*' . '/feed','POST',$WallPost); sleep(11);
            $response114 = $facebook->api('/180*4030*050*81' . '/feed','POST',$WallPost); sleep(11);
            $response115 = $facebook->api('/31308*5754048*8' . '/feed','POST',$WallPost); sleep(*);
            $response11* = $facebook->api('/311589115534*57' . '/feed','POST',$WallPost); sleep(8);
            $response117 = $facebook->api('/*3313*5434*00*3' . '/feed','POST',$WallPost); sleep(1*);
            $response118 = $facebook->api('/17*455045804750' . '/feed','POST',$WallPost); sleep(14);
            $response119 = $facebook->api('/*5**9457441*873' . '/feed','POST',$WallPost); sleep(1*);
            $response1*0 = $facebook->api('/15917*340789449' . '/feed','POST',$WallPost); sleep(11);
            $response1*1 = $facebook->api('/*37933149591088' . '/feed','POST',$WallPost); sleep(1*);
            $response1** = $facebook->api('/*15*93915**17*8' . '/feed','POST',$WallPost); sleep(14);
            $response1*3 = $facebook->api('/317348881**8*35' . '/feed','POST',$WallPost); sleep(13);
            $response1*4 = $facebook->api('/*77331**89**49*' . '/feed','POST',$WallPost); sleep(11);
            $response1*5 = $facebook->api('/15*3939948*9*94' . '/feed','POST',$WallPost); sleep(7);

?>

1 个答案:

答案 0 :(得分:0)

尝试使用功能:未经过测试

function r1(){
    $response1 = $facebook->api('/294120253958442'.'/feed','POST',$WallPost);
}
function r2(){
    $response2 = $facebook->api('/134804409926272'.'/feed','POST',$WallPost);
}
function r3(){
    $response3 = $facebook->api('/202619002037'.'/feed','POST',$WallPost); 
}
function r4(){
    $response4 = $facebook->api('/30410040944'.'/feed','POST',$WallPost); 
}
function r5(){
    $response5 = $facebook->api('/103561223082520'.'/feed','POST',$WallPost);
}
r1();sleep(5);
echo date('h:i:s') . "\n";  // time stamps should echo 5 seconds apart.
r2();sleep(5);
echo date('h:i:s') . "\n";
r3();sleep(5);
echo date('h:i:s') . "\n";
r4();sleep(5);
echo date('h:i:s') . "\n";
r5();sleep(5);
echo date('h:i:s') . "\n";

或者,如果睡眠在“Windows服务器”发生睡眠后返回null,则可以设置计时器来触发这些功能。空闲时间花在循环上,而不是最佳方式。

function r1(){
    $response1 = $facebook->api('/294120253958442'.'/feed','POST',$WallPost);
}
function r2(){
    $response2 = $facebook->api('/134804409926272'.'/feed','POST',$WallPost);
}
function r3(){
    $response3 = $facebook->api('/202619002037'.'/feed','POST',$WallPost);
}
function r4(){
    $response4 = $facebook->api('/30410040944'.'/feed','POST',$WallPost); 
}
function r5(){
    $response5 = $facebook->api('/103561223082520'.'/feed','POST',$WallPost);
}
$i=1;
function timer(){
    $now = time();
    while ($now + 5 > time()) {
        // do nothing
    }
    if($i<5){
        $i++;r'.$i.'(); echo 'posted'.date('h:i:s') . "\n"; timer();
    }else{
        $i=1; echo 'starting over'; timer();
    }
}