|
Posted by Jay Blanchard on 10/25/05 16:36
Howdy all,
I am trying a new technique, for me, when processing a form. The form is
filled out and submitted, during processing it is determined that there is
an error with the posted data...such as a blank or mismatched password,
I want to return the form with the data filled out using curl....as a test I
did this....
/* curl post test */
$post_data['username'] = $_POST['username'];
$post_data['password'] = $_POST['password'];
$url = "http://TEST20051010/FMSRegister.php";
/* assemble POST data in string */
$pd="";
foreach ($post_data as $k=>$v){
$pd.= "$k=".$v."&";
}
$post_data=substr($pd,0,-1);
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_URL, $url);
curl_exec($ch);
curl_close($ch);
Now, this works OK...save for one little problem that I cannot seem to
figure out. The URL now reads
http://TEST20051010/NameOfProcessingScript.php instead of
FMSRegister.php.
I am searching the curl options http://www.php.net/curl_setopt but have not
found what I am looking for. Can someone clue me in?
Thanks!
[Back to original message]
|