curl批量伪造数据

<?php
set_time_limit();
$url = "http://www.ciweishixi.dev/app.php?c=form&a=submitActivity";
$num = ;
for($k = ; $k < ; $k++ ){
$data = array(
'child_flag' => 'urkldasd' ,
'field_11' => "单选2--" .getRandom() ,
'field_12'=>getRandom() ,
'field_13'=>"单行文本输入-2-----" . getRandom() ,
'field_14'=>"多行输入" . getRandom() ,
'flag' =>"data323" ,
'source'=>"pc" );
$data = RequestData($url , $data );
$data = json_decode($data , true );
if($data['code'] == ){
$num++;
}
usleep(); }
echo "success is : $num "; function RequestData($url,$data = null){
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
if (!empty($data)){
curl_setopt($curl, CURLOPT_POST, );
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
}
curl_setopt($curl, CURLOPT_RETURNTRANSFER, );
$output = curl_exec($curl);
curl_close($curl);
return $output;
} function getRandom($length = , $type = ) {
switch ($type) {
case :
$string = '';
break; case :
$string = 'abcdefghijklmnopqrstuvwxyz';
break; case :
$string = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
break; case :
$string = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
break; case :
$string = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
break;
}
$output = '';
for ($i = ; $i < $length; $i++) {
$pos = mt_rand(, strlen($string) - );
$output .= $string[$pos];
}
return $output;
}
上一篇:告知服务器意图的http方法


下一篇:windows Server 2008 R2的安装