我的CURL脚本有问题


There is something wrong with my CURL script

我使用CURL脚本来基本上重新创建用户必须在表单上点击send的过程。我希望所有内容都在后台运行,但当这个脚本执行时,它从不发送。

$ch = curl_init();
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
    "&shopId=".$ID."&encodedMessage=".urlencode($encodedMessage)."&signature=".$signature);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_USERAGENT, 
    "Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20041001 Firefox/0.10.1" );
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$result = curl_exec($ch); 

它可能没有执行吗?

经过测试,运行良好。

您是否正确设置了变量$url

curl不是模拟fork的好选择。

一旦当前脚本停止,curl请求就会被终止,目标url可能也会停止执行自己的脚本。

您可以使用cron或类似的外部进程来运行curl请求,并且它将在不中断的情况下运行。将并行请求排队也会很有帮助。