[英]php retrieve curl_setopt POSTFIELDS string
Is there any way to retrieve the curl_setopt POSTFIELDS string which I had posted to the site after the curl_multi_exec($mh, $running) command? 在curl_multi_exec($ mh,$ running)命令之后,有什么方法可以检索我发布到站点的curl_setopt POSTFIELDS字符串?
Thanks. 谢谢。
You have to keep that data together with the individual resources: 您必须将这些数据与各个资源一起保存:
$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,
);
}
This keeps the cURL handles and data together in a single structure that you can later use to inspect. 这样可以将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']);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.