I'm trying to make two file talk to each other. 'output_file.php' to send data from domain 'a' to input_file located on domain 'b'. Data from output file will later be send to crm via api.
I'm stuck as I don't know what am I doing wrong, what should I change in these files?
Here is output_file.php:
<?php
//send cURL
$curl = 'https://domain_name/input.php';
$fields = array(
'name' => urlencode($_POST['name']),
'email' => urlencode($_POST['email']),
'tel' => urlencode($_POST['tel']),
);
//var_dump($fields);
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string, '&');
//var_dump($fields_string);
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $curl);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
$result = curl_exec($ch);
//var_dump($result);
curl_close($ch);*/
?>
Here is input_file.php:
// main data about the person. person_id is added later dynamically - PERSON DATA
$person = array(
'name' => 'name from output_file.php',
'email' => 'email from output_file.php',
'phone' => 'tel from output_file.php'
);