I want to ask about array
in php.
I have build curl php
and it is successfully transferring the data. But my problem is that I want to transfer that by using array.
This is my code:
<?php
$sql = "SELECT domain_name FROM domain";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0)
{
while($row = mysqli_fetch_assoc($result))
{
$domain= $row['domain_name'];
$content= $row['domain_content']; // get values row-wise from db
$reason = $row['reason'];
$curlHandle = curl_init();
curl_setopt($curlHandle, CURLOPT_URL, '192.168.100.2/update.php');
curl_setopt($curlHandle, CURLOPT_POST, 1);
curl_setopt($curlHandle, CURLOPT_HEADER, 0);
curl_setopt($curlHandle, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curlHandle, CURLOPT_POSTFIELDS, 'domain_name='.$domain.);
curl_setopt($curlHandle, CURLOPT_FOLLOWLOCATION,1);
curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER,1);
if (!curl_exec($curlHandle))
{
//echo 'everything was successful';
}
else
{
echo 'An error has occurred: ' . curl_error($curlHandle);
}
} /* END OF WHILE LOOP */
} /* END OF NUM ROWS RESULT IS MORE THAN 0 */
else
{
echo "0 results";
}
?>
From code above, the system will running in a loop when sending the data until all data from database was transferred.