Forms: Submit to two at once?
Moderator: General Moderators
Forms: Submit to two at once?
Hi all, im having a small problem. I have a form that the information needs to be sent to two differant places. Once it is sent to one place i dont have control of where it goes from there (ie. its not my site). Is there a way with PHP that i can submit to both places at the same time?
You can post info to external sites manually with PHP using [php_man]fsockopen[/php_man]. There may be an easier way but this is how I do it:
Code: Select all
<?php
$url = fsockopen ('http://www.blah.com', 80);
$data = 'variable=value&variable2=something';
$length = strlen ($data);
$post = "POST /path/to/script HTTP /1.0\n";
$post .= "Content-Length: $length\n";
$post .= "Content-Type: application/x-www-form-urlencoded\n";
$post .= "Connection: Close\n\n";
$post .= "$data\n\n";
fputs ($url, $post);
fclose ($url);
?>