My current host doesn’t allow remote mysql acces so I need to work around it by having script1 on server1 communicate with script2 on server2. I am trying to send post data to script2, which then takes that data and puts it into mysql. To keep my question simple I stripped the code down to this:
script1
for ( $counter = $counternumbernao; $counter <= $amountofcomments; $counter += 1)
{
echo'
<form action="http://server2.x.com/form-receive.php" method="post">
<INPUT TYPE=HIDDEN NAME="comment_content" value=$comment_content>
<INPUT TYPE=HIDDEN NAME="comment_date" value=$comment_date">
<input type="submit" />
</form>
';
}
How can I alter this code, so that every time the loop occurs it automatically sends the $_POST data to script2, which then puts it into mysql? I didn’t think it was necessary to include script2 as it’s not important to this issue.
To have this automatically occur without the end user being aware of this behaviour, the best way would be to use CURL (http://php.net/manual/en/book.curl.php).
Here’s an example of how it would look: