Send curl request with form values using PHP -
i have page this:
<form action method="post"> <input type="hidden" name="rand" value="casualnumbers"> <input type="submit" value="submit"> </form>
i need result page, sending curl "rand" value post variable.
i know how send post variables using:
curlopt_postfields => array("rand" => "casualnumbers")
but how can take "casualnumbers" form page?
the page generates random value , post request works if gets right random value, need take random value page , send post request right random value
that's use:
preg_match_all('/<input.*type="(submit|hidden)".*name="([^"]+)".*value="([^"]*)".*>/u',$form_html,$vars); $post_vars=array(); for($i=0;$i<count($vars[2]);$i++) $post_vars[$vars[2][$i]]=$vars[3][$i]; curl_setopt($curl,curlopt_post, true); curl_setopt($curl,curlopt_postfields,$post_vars);
hope helps.
Comments
Post a Comment