PHP類比趕集登陸,需要驗證碼問題

來源:互聯網
上載者:User
用php 類比趕集發布房源時 ,類比登陸後,一會時間就不能登陸了,需要驗證碼 , 看怎麼能處理下,請教下有經驗的朋友 ,謝謝 !
           $url = "https://passport.ganji.com/login.php";        $data ="login_username=wangsheng6666666666&login_password=".trim(decode('bGlqaWF3YW5nc2hlbmcyMDEz'));       //  $imageurl= 'https://passport.ganji.com/ajax.php?dir=captcha&module=login_captcha&nocache=1445313015271';         $redata= $publish->vlogin($url,$data,$url,true);              function vlogin($url,$data,$REFERER =null,$ishttps=true){ //        $curl = curl_init(); // 啟動一個CURL會話        curl_setopt($curl, CURLOPT_URL, $url); // 要訪問的地址        curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // 類比使用者使用的瀏覽器        if(empty($REFERER))        {            curl_setopt($curl, CURLOPT_AUTOREFERER, 1); // 自動化佈建Referer        }else{            curl_setopt($curl, CURLOPT_REFERER, $REFERER);// 設定Referer        }        if($ishttps)        {            curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // 對認證認證來源的檢查            curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); // 從認證中檢查SSL密碼編譯演算法是否存在        }        curl_setopt($curl, CURLOPT_POST, 1); // 發送一個常規的Post請求        curl_setopt($curl, CURLOPT_POSTFIELDS, $data); // Post提交的資料包       // curl_setopt($curl, CURLOPT_COOKIEFILE, $this->cookie_file); // 讀取上面所儲存的Cookie資訊       // curl_setopt($curl, CURLOPT_COOKIEJAR, $this->cookie_file); // 存放Cookie資訊的檔案名稱        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 擷取的資訊以檔案流的形式返回        curl_setopt($curl, CURLOPT_TIMEOUT, 30); // 設定逾時限制防止死迴圈        curl_setopt($curl, CURLOPT_HEADER, 1);        $tmpInfo = curl_exec($curl); // 執行操作        if (curl_errno($curl)) {            echo 'Errno'.curl_error($curl);        }       // preg_match_all('/Set-Cookie:stest=(.*)/i', $tmpInfo, $tmpInfo);        curl_close($curl); // 關閉CURL會話        return $tmpInfo; // 返回資料    }

請大家幫忙看看 謝謝


回複討論(解決方案)

你發布房源 太頻繁了吧。?

驗證碼 你能搞定?? 估計大神來了一樣搞不定

驗證碼 彈出識別 輸入 是一項大工程
估計難道屬於A++ 識別率一般都很差

驗 證嗎,只有把它輸出來 讓人工輸入,顯人工輸入,找個打碼平台對接

驗證碼沒有辦法自動識別,即使能識別,也是很簡單的那種,我最後,採用直接輸入的方式,處理了 謝謝,各位了
php curl 擷取驗證碼時 ,需要擷取cookie,這樣,提交驗證時,採用同樣的cookie ,就可以了

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.