有什么方法可以检索我在 curl_multi_exec($mh, $running) 命令之后发布到网站的 curl_setopt POSTFIELDS 字符串?
谢谢。
您必须将该数据与各个资源一起保存:
$handles = array();
foreach ($urls as $url) {
$ch = curl_init($url);
$data = 'whatever';
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$handles[$url] = array(
'ch' => $ch,
'data' => $data,
);
}
这将 cURL 句柄和数据保持在一个单一的结构中,您以后可以使用它来检查。
foreach($handles as $url => $data) {
// $url is the page you requested for this particular handle
// $data['data'] contains the data that goes with it
$body = curl_multi_getcontent($data['ch']);
curl_multi_remove_handle($mh, $data['ch']);
curl_close($data['ch']);
}