我有多个XML_PAYLOAD
要发布(每个 while 循环的不同 xml 帖子)。当我运行循环时,它只会POST
显示第一个$i
循环的数据。如何获取POST
每个$i
循环的新数据?
$i = 0;
while ($i < $num) {
...data
define("XML_PAYLOAD", "<?xml stuff and tags?>");
define("XML_POST_URL", "http://theurl");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, XML_POST_URL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_POSTFIELDS, XML_PAYLOAD);
$result = curl_exec($ch);
curl_close($ch);
$i++;
}