Page 1 of 1

How to send a post header programatically

Posted: Wed Jun 01, 2005 8:01 pm
by flycast
I have a host that will not allow me to use the mail() function in PHP scripts. He has his own ColdFusion script that he wants me to submit form information to. The problem is that this bypasses all the error checking of the form since the form is written as a self submitting form. I don't want to use javascript for error checking as 10% of browsers have it turned off.

Is there a way for me to salvage my self submitting form by replacing the mail() function with a header() function that would neatly look like it was submitted by my original form? IF this can be done what would the header look like?

Thanks,
Eric

Posted: Wed Jun 01, 2005 10:23 pm
by JAM
It should work. Get the $_POST array values, and transfer it within the URI might be on idea. Not perhaps correct, but you get the ideas:

Code: Select all

// ... code ...
// mail(...);
foreach ($_POST as $key => $val) {
 $array[$key] = $val;
 $string = base64_encode(serialize($array));
 header("Location: ./theotherpage.php?postinfo={$string}");
}
...then base54_decode and unserialize the $_GET['postinfo'] being sendt in theotherpage.php.

There is also cURL() to name something else.

Posted: Fri Jun 03, 2005 7:22 am
by flycast
HOw could I capture and examine a header? My thought is to submit some infro from a form to another page and examine th ehader to make sure I get all the dataila just right.

Thanks,
Eric

Posted: Fri Jun 03, 2005 7:26 am
by Syranide
a little tip is otherwise to use some other class, there is a neat bunch of classes (SMTP/mail) which sends a message equally to the internal mailfunction... there is probably a functiondefinition somewhere which works just like mail() too.
(let's you specify everything the way you want with possibly full errorchecking)