This question has been answered by ilja-web. See the first response.
Hello ilja-web
Thanks for the pointer to cloudstitch. Think it's what I'm looking for too. How did you get on using it? Did it work well with formit?
<?php
$name = $hook->getValue('fname'), FILTER_SANITIZE_EMAIL);
$email = filter_var($hook->getValue('femail'), FILTER_SANITIZE_EMAIL);
$data = array(
'userName' =>$name,
'userEmail' =>$email
);
$url = 'https://api.cloudstitch.com/link/to/sheet';
$options = array(
'http' => array(
'method' => 'POST',
'content' => json_encode( $data ),
'header'=> "Content-Type: application/json\r\n" .
"Accept: application/json\r\n"
)
);
$context = stream_context_create( $options );
$result = file_get_contents( $url, false, $context );
$response = json_decode( $result );
if($response->success === true){
var_dump('succes');
} else {
var_dump('fail');
}
// Return
return true;