|
Posted by Erwin Moller on 01/17/07 09:38
Sandman wrote:
> Hi there,
> So here is the situation I'm in. My PHP script does something like
> this:
>
> 1. Update a DB (only once)
> 2. Send some post data to another PHP script (only once)
> 3. Output some stuff related to 1 and 2.
>
> I've done #2 by using input type="hidden" on a form, like so:
> print "<form action='../dir/register.php' method='post'
> name='DirReg'>";
> print "<input type='hidden' name='username' value='$sname' >";
> print "<br>";
> print "<input type='hidden' name='email' value='$email' >";
> print "<br>";
> print "<input type='hidden' name='password' value='$pwd' >";
> print "<br>";
> print "<input type='hidden' name='password2' value='$pwd' >";
> print "<br>";
> print "</forum>";
>
> print "<script language=javascript>";
> print "document.DirReg.submit()";
> print "</script>";
> }
>
> This works awesomely, but the problem is that control flows to the
> script that performs the action on the form. I kinda want to send this
> stuff to the PHP script, and then continue processing the rest of PHP
> script #1. In the UNIX world I would put the form job in the
> background. Is there a way of doing that here?
>
> Thanks,
Hi,
Yes, you can do the post without any clientcontact by using a package name
CURL.
http://www.php.net/curl
With CURL you can also catch the output of the called script (#2), maybe to
check for errors or something like that.
Also, stop using:
<script language="javascript">
and switch to:
<script type="text/javascript">
Regards,
Erwin Moller
[Back to original message]
|