I have multiple XML_PAYLOAD
's to post (different xml posts for each while loop). When I run the loop it will only POST
the data of the first $i
loop. How can I get it to POST
new data for each $i
loop?
$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++;
}