I am new to CURL, my requirement is to login to a Portal and submit a form. So far, my CURL code logs in to the portal, but when it comes to the form, I don't want it to submit/post the form for now.. so that I can see what strings are being passed to the form's <input>
fields.
The code below autofill
and autosubmit
the form, but I want only autofill the form for now.
<?php
$data=array();
$data['usr']='username';
$data['pswd']='password';
$post_str=' ';
foreach($data as $key=> $value){
$post_str.=$key.'='.urlencode($value).'&';
}
$post_str=substr($post_str,0,-1);
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,"http://benefit.blue-ex.com/customerportal/");
curl_setopt($ch,CURLOPT_POST,true);
curl_setopt($ch,CURLOPT_POSTFIELDS, $post_str); $response=curl_exec($ch);
curl_close($ch);
echo $response;
?>