我使用curl发布到网络表单,但我遇到了单选按钮的问题。我将值传递给参数但是当我打电话时,网站回复告诉我必须选择一个选项。我认为有一些javascript验证要求检查属性。有什么形式可以绕过这个吗?也许设置checked属性,然后做curl post? 这是表单的html代码:
<div class="unit"><input type="radio" tabindex="11" value="4" id="atrib_1" name="attr_frete" class="radio_bt"></div> <label for="atrib_gratis" class="radio_label">Flete 1</label> <div class="unit"><input type="radio" tabindex="11" value="5" id="atrib_2" name="attr_frete" class="radio_bt"></div> <label for="atrib_gratis" class="radio_label">Flete 2</label></div>
这是PHP发布的代码:
$parametros_post = array('STEP'=>$value1,'qb4_cat_id' =>$value2,'title'=>$model->Titulo,'description'=>$model->Descripcion,'tag_1' =>'','tag_2' =>'','tag_3' =>'','tag_4' =>'','tag_5' =>'','tag_6' =>'','attrib_34' =>'414','dinheiro' =>'true','deposito-bancario' =>'false','cheque' =>'false','cartao-credito' =>'false','combinar' =>'false','bb_file_input' =>$foto1,'preco' =>$model->Precio,'qt_estoque' =>'1','attr_frete' =>'5');
$result = $this->PostCurl("http://www.site.com/publicar-anuncio-gratis.html?sent=true",$parametros_post);
function PostCurl($url,$parametros_post){
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)');
curl_setopt($ch,CURLOPT_HTTPHEADER,array("Accept-Language: es-es,en"));
curl_setopt($ch,CURLOPT_POST,true);
curl_setopt($ch,CURLOPT_POSTFIELDS,$parametros_post);
curl_setopt($ch,CURLOPT_HEADER,true);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_COOKIEJAR,'cookies.txt');
curl_setopt($ch,CURLOPT_COOKIEFILE,'cookies.txt');
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
$result = curl_exec($ch);
$rerror = curl_error($ch);
curl_close($ch);
if ($rerror != ""){
return $rerror;
}
else
return $result;
}
答案 0 :(得分:0)
如果您使用原始表单,帖子请求会是什么样子?使用卷曲时它看起来像什么?如果你比较这两个,你应该找到差异。
如果没有,您可能会怀疑是否存在对自动请求进行检查的情况,但目前尚无证据。