Sending POST data with cURL.

You may want to pass data to another url using data from the database,in this way a user does not need to enter the data in the form,you can use GET to pass it however the data will be availlable on the url and therefore a user may temper with it or collect it and use it for other malicious intentions.

We achieve this using cURL which transfers data using different protocols,here is a snippet on how to use cURL.

// Get cURL resource
$curl = curl_init();
// Set some options
curl_setopt_array($curl, [
CURLOPT_URL => 'http://localhost/curlpost/receive.php',
CURLOPT_USERAGENT => 'Code Snippet from',
domain => '',
email => '',
phone => '254797669121',
purpose => 'web hosting'
// Send the request and test for error
if (!curl_exec($curl)) {
die('Error: "' . curl_error($curl) . '" - Code: ' . curl_errno($curl));
// Close request to clear up some resources

Copy the code above in to your text editor and change the parameters accordingly.