one submission page, post the content to two site ?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
phpp
Forum Newbie
Posts: 3
Joined: Mon Sep 14, 2009 10:07 pm

one submission page, post the content to two site ?

Post by phpp »

one submission page, submit the content to two site at the same time. can you make it help me?How?
-----------------------------------------------------------------
submit page (test.php)

Code: Select all

<table><form name="form" method="post" [color=#40BFFF][b]action=""[/b][/color] >?
<tr><td>name1: <input type="text" name="name1" ></td></tr>
<tr><td>name2: <input type="text" name="name2"></td><td><input type="submit" 
 
name="submit" value="ok"></td></tr></form></table>
// action="http://localhost/one/test1.php" and action="http://localhost/two/test2.php"
------------------------------------------------------------------
accept page1 (test address: http://localhost/one/test1.php)

Code: Select all

<?php
$fp = fopen("test1.txt","a");
$name1=$_POST[name1];
$name2=$_POST[name2];
$str = "name1: ".$name1." name2: ".$name2."\r\n";
fwrite($fp,$str); 
fclose($fp);
?>
-------------------
accept page2 (test address: http://localhost/two/test2.php)

Code: Select all

<?php
$fp = fopen("test2.txt","a");
$name1=$_POST[name1];
$name2=$_POST[name2];
$str = "name1: ".$name1." name2: ".$name2."\r\n";
fwrite($fp,$str); 
fclose($fp);
?>
-----------------------------------------------------------------
Last edited by phpp on Wed Sep 16, 2009 7:47 am, edited 1 time in total.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Re: one submission page, post the content to two site ?

Post by superdezign »

Don't type in pink, please.

I think cURL has mechanisms for posting data to another page. However, if you are planning on going from one page to another, I don't believe that creating another POST request is possible without another form. You would have to use the query string to pass the variables with the GET method, or you would need to save the posted values into a form and have the user submit that form to the next page.
phpp
Forum Newbie
Posts: 3
Joined: Mon Sep 14, 2009 10:07 pm

Re: one submission page, post the content to two site ?

Post by phpp »

superdezign wrote:Don't type in pink, please.

I think cURL has mechanisms for posting data to another page. However, if you are planning on going from one page to another, I don't believe that creating another POST request is possible without another form. You would have to use the query string to pass the variables with the GET method, or you would need to save the posted values into a form and have the user submit that form to the next page.
but because file type file size is very big! then why?

Code: Select all

<form name="form" method="post" action="" enctype="multipart/form-data">
<input type="hidden" name="file" value="0" >
<input id='file' type="file" name="file"  ><input type="submit" name="submit" value="ok" ></form>
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Re: one submission page, post the content to two site ?

Post by superdezign »

You are attempting to pass a file from one form to another?

And I'm positive that advertising is not allowed in your signature.
phpp
Forum Newbie
Posts: 3
Joined: Mon Sep 14, 2009 10:07 pm

Re: one submission page, post the content to two site ?

Post by phpp »

superdezign wrote:You are attempting to pass a file from one form to another?

And I'm positive that advertising is not allowed in your signature.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Re: one submission page, post the content to two site ?

Post by superdezign »

phpp wrote:
superdezign wrote:You are attempting to pass a file from one form to another?

And I'm positive that advertising is not allowed in your signature.
I see you removed the ads in your signature. However, just quoting me doesn't really give us much insight into your problem. :?:
User avatar
Mirge
Forum Contributor
Posts: 298
Joined: Thu Sep 03, 2009 11:39 pm

Re: one submission page, post the content to two site ?

Post by Mirge »

Using cURL you can send data wherever you want via GET _or_ POST... see the manual:

http://us.php.net/curl/
Post Reply