驗證碼本來就反正遠程暴力提交數據的,但我就要遠程提交數據。遠程獲取目標網站的驗證碼
再人工填寫驗證碼提交數據。
這樣用到PHP的GD擴展庫來實現這個問題,實現原理並你想的還簡單
set_time_limit(0);//設置PHP超時時間
$url = "http://218.75.208.58:83/CheckCode.aspx";
if(empty($url)){
echo "沒有圖片";
exit;
}
$imginfo = getimagesize ( $url );
$type = $imginfo["mime"];
$imgw = $imginfo [0];
$imgh = $imginfo [1];
$bg = imagecreatetruecolor($imgw,$imgh);
$image = imagecreatefromgif($url);
imagecolorallocate($image,255,255,255);
imagecopy($bg,$image,0,0, 0,0,$imgw,$imgh);
imagedestroy($image);
header("Content-type:".$type);
imagegif($bg);
這樣就可以遠程獲取都這台服務器的驗證碼了? 我現在考慮的不是這個問題。我一直在想,我這樣獲取到了驗證碼,我下次用curl提交的時候,是不是還是這個驗證碼呢? 所以我現在也很期待我的第二個實驗。 遠程提交驗證加數據。