0

I'm writing a php file that can send the same form data to different urls on different servers.

<?php 
$urls = array("some_url_num1.php", "some_url_num2.php", "some_url_num3.php");
foreach ($urls as $url) {
echo '<form action="'.$url.'" method="post">
Time From: <br> <input type="text" name="timefrom"><br>
Time to: <br><input type="text" name="timeto"><br>
Password: <br> <input type="password" name="password"><br>
<input type="submit"><br></form>';
}
?>

Currently there are 3 forms on the page, and the user needs to enter the same data (timefrom, timeto, password) three times in order to get the result from some_url_num1.php, some_url_num2.php, some_url_num3.php.

Is there anyway, using php, to let the user enter only once, and get the result from the three .php files?

5
  • This is just bad design and will result in the users not actually using this thing. Commented Feb 12, 2015 at 17:54
  • Do those files live on the same server? Commented Feb 12, 2015 at 17:57
  • Thanks for asking @Daniel. Those files are not on the same server. This is an one time script that needs to access around 100 urls. I'd like to use this script to make the process as faster & convenient as possible. Commented Feb 12, 2015 at 18:00
  • What conceivable reason could there be to post to 100 urls? Commented Feb 12, 2015 at 21:18
  • I'm creating a customized sales report which needs to access the 100 magento sites (100 urls). Using magento backend > report is very slow, so I am writing a file to make it faster. I've already figured it out :) Commented Feb 12, 2015 at 21:25

1 Answer 1

1
  1. Create a single form

  2. Collect data in a single php file

  3. From that php file, send user submitted data to other urls using curl

For CURL details you can refer PHP manual

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.