例えば
<?php
//GetParameters here
//send response/end connection
//keep executing the script with the retrieved parameters.
例えば
<?php
//GetParameters here
//send response/end connection
//keep executing the script with the retrieved parameters.
あなたはこれを行うことができますが、ちょっといじる必要があるかもしれません. 最初のスクリプトで接続を閉じようとする代わりに、別のスクリプトでデータを処理する必要があります。
<?php
//Get Parameters
//Send output to user
//now use curl to access other script
$post = http_build_query($_POST); // you can replace this with a processed array
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.example.com/otherscript.php");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_exec($ch);
curl_close($ch);
?>
otherscript.php
<?php
header( "Connection: Close" );
// do your processing
?>
説明すると、curl が接続すると、接続が閉じられたヘッダーが取得されるため、curl は終了します。一方、「otherscript」は、開いている接続なしでデータを処理しています。
exec() を使用することもオプションであると確信しています。コマンド ラインで変数をコマンド ライン引数として渡すことで、php を使用して otherscript を呼び出すことができます。Linuxを実行している場合、次のようなものが機能するはずです。
exec("nohup php -f otherscript.php -- '$arg1' '$arg2' < /dev/null &");
現在、otherscript.php は別のプロセス ID でバックグラウンドで実行されています。