怎么设置反限制?

时间:2015-12-08 20:08:17

标签: php curl

嗨,我有一个计数器代码。我想在(例子)11结果时停止。当脚本计数11结果时,如何停止卷曲?

<?php
class instaAuth
{
    public function _userlistesi() {
        $klasor = opendir("cookieboq/");
        while(false !== ($veriler = readdir($klasor))) {
            if(strstr($veriler,'selco')) {
            $bir_veri = str_replace('.selco','',$veriler);
            $user_ekle .= "$bir_veri,";
        }
    }
    $userler = substr($user_ekle,0,-1);
    $users_arr = explode(",",$userler); 
    return $users_arr;
    }

public function _authLike($_ID,$userlist, $DELETE = NULL)
    { 
        if ( !empty($userlist) )
        {
            $type = ($DELETE == TRUE) ? 'unlike' : 'like';

            $members = array();
            $params = array();
            foreach ( $userlist as $username )
            {
                $_cookie = $this->_cookieFolder . $username . $this->_cookieExtension;
                $randomProxy = ( count($this->_proxy) > 0 ) ? $this->_proxy[rand(0, (count($this->_proxy) - 1))] : NULL;

                if ( !file_exists($_cookie) )
                {
                    continue;
                }
                $members[] = $username;
                $fake_ip = $this->fakeIP();
                $header = array(
                    "Accept: */*",
                    "Accept-Language: tr;q=1",
                    "HTTP_CLIENT_IP"        => $fake_ip,
                    "HTTP_FORWARDED"        => $fake_ip,
                    "HTTP_PRAGMA"           => $fake_ip,
                    "HTTP_XONNECTION"       => $fake_ip,);

                $options = array(
                    CURLOPT_POST => TRUE,
                    CURLOPT_POSTFIELDS => $this->signed(json_encode(array())),
                    CURLOPT_HTTPHEADER => $header,
                    CURLOPT_COOKIEJAR => $_cookie,
                    CURLOPT_COOKIEFILE => $_cookie,
                    CURLOPT_USERAGENT => $this->_useragent,
                );

                $params[] = array(
                    'url' => "https://i.instagram.com/api/v1/media/{$_ID}/{$type}/",
                    'options' => $options
                );
            }
        } else {
            throw new Exception('Error: _authLike() - Beğeni yaptırabilmeniz için {cookies} tanımlamalısınız.');
        }   
        $multiCURL = new \RollingCurl\RollingCurl();
        foreach ($params as $param) {
            $request = new \RollingCurl\Request($param['url'], 'POST');
            $request->setOptions($param['options']);
            $multiCURL->add($request);
        }

        $this->_result = 0;
        $multiCURL
            ->setCallback(function(\RollingCurl\Request $request, \RollingCurl\RollingCurl $rollingCurl) {

                $result = $request->getResponseText();
                if ( is_string($result) )
                {
                    $result = json_decode($result);
                    if ( is_object($result) )
                    {
                        if ($result->status == 'ok') $this->_result++;
                    }
                }
            })
            ->setSimultaneousLimit(100)
            ->execute()
        ;

        $result = array(
            'success' => $this->_result,
            'errors' => NULL
        );

        return json_decode(json_encode($result));

    }
}

以及其他感兴趣的其他代码页

<form action="" method="POST">

Pictures ID : <input type="text" name="apifotoId">
<br>
Limits : <input type="text" name="limit">
<br>
<input type="submit" value="Like Send">
</form>
<?php
include("class.php")
if(isset($_POST['apifotoId'])) {
$start = time();
$y = new instaAuth(); 
$user_list = $y->_userlistesi();
$limit = $_POST["limit"];
$_ID = $_POST['apifotoId'];
$y->_authLike($_ID,$user_list);

$fark = round(time()-$start)/60;
echo "Likes Complete (".$fark." dk.)"; 

}

?>

我想在(例子)11结果时停止。当脚本计数11结果时,如何停止卷曲?

1 个答案:

答案 0 :(得分:-1)

你只能在函数&#34; authLike&#34;中创建一个if语句。条件if(result ==11) break;  如果你明确你的答案来帮助你更多,那么你就可以了。

相关问题